Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
393 cbyrd vue component guidance #394
393 cbyrd vue component guidance #394
Changes from all commits
c5f933c
d7f53ac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to get a
.prettierrc
in place as soon as possible so we can standardize on:And have a github action step fail PRs that haven't been formatted. Then we can socialize the knowledge about how to configure "format on save" in VS Code so that you never have to hand-format again. (Separately, I'll suggest doing the same thing with the python backend because we seem to get lots of PRs with unrelated formatting changes on a regular basis...)
I don't have a strong preference about quote or indentation width myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
archesproject/arches#10575
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include an example with a nested
/types
directory? When typing an API response (in particular) it's nice to have them outside somewhere that don't clutter up the component. Or is that overkill for this example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Header, Bio, and Actions are all imported into UserProfile.vue what goes in UserProfileView.vue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @ryan86
UserProfileView.vue
is a higher-order component. It's purpose is to bring together the lower-order components and maybe some window dressing around them. egThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed we'll have to silence the vue warnings for this:
And it's too bad that JS variables in
<script setup>
now show as unused in VS Code. Maybe the tooling will catch up.In vue 3.4+ (once the tooling catches up, b/c I don't seem to be able to use it now), we might be able to prefer:
instead of:
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll definitely look into this, it might be preferable to amend the current documentation to prefer the shorthand -- I'm not against the notion 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is perfect. There's nothing else that makes sense.
In a more contrived example, you end up with more options about where to shove things. If there are a lot of arrow functions, you can group them all together, or you can keep the setter right next to where the state is declared. (Kind of like
const [count, setCount] = useState(0);
in React.)In other words, a more contrived example might look like (knowing full well that the worse this gets the more it signals some decomposition is called for 😉 ):
Again, this is testing the edges of too-much-in-one-file, but I think it's not far from realistic (a couple of pieces of reactive state, a couple of callbacks, data fetching, and a toast for error handling)
These are all debatable, but what do you think about:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should each category also be alphabetized? Static consts A-Z, props A-Z, functions A-Z, etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, maybe additional category for vue lifecycle hooks unless we want to include them with arrow functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryan86 👋
alpha'ing constants and callbacks seems like overkill to me in my experience. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice example. Foo!
[Off topic] By the way, do you happen to know what procedure compiles strings for translators? Do they get de-duped between the frontend and backend the way they do now? E.g.:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @jacobtylerwalls
As far as the
vue3-gettext
implementation is concerned, it's on a per-filetree/project basis. Essentially thepath
value ingettext.config.js
can only accept a single directory. I've not dug in enough to know if there's de-duplication at the filetree/project level but that will be interesting to explore