refactor: cleaned up old composables to follow proper conventions#183
Merged
Conversation
Member
|
I did not know the second approach yet. While it's of course less code and probably a bit more advanced, I think the first approach still succeeds in terms of understanding what actually happens there, so I'd say it's fine the way it is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR description
Describe your changes in detail here
The old composables useRunning and useForceRerender didn't really follow any composable guides and over the time as we got more composables they all followed a more structured approach, this just updates the code for better readability and use of it.
Now it is like we default export a function all the time so we have to import the base function initially like:
// import composable
import useTokenGenerator from '@/composables/useTokenGenerator/useTokenGenerator';and then we can use the base function and destructuring and get the child functions.
// import functions and variables
const { defaultRules, generateValidToken } = useTokenGenerator();A different approach could be that we don't use default export, and then we instantly can destructure in the import, if you prefer this appraoch I'll have to adjust the code again.
// just as an example
import { defaultRules, generateValidToken } from '@/composables/useTokenGenerator/useTokenGenerator';Both are valid, we just should decide how we want to do it.
Definition Of Done (DoD)
This PR can be squashed / merged if
Add additional conditions here if necessary for this PR
fix: #182