Skip to content

refactor: cleaned up old composables to follow proper conventions#183

Merged
tonoizer merged 2 commits into
mainfrom
feat/182-improve-composable-conventions
May 30, 2023
Merged

refactor: cleaned up old composables to follow proper conventions#183
tonoizer merged 2 commits into
mainfrom
feat/182-improve-composable-conventions

Conversation

@tonoizer

@tonoizer tonoizer commented May 28, 2023

Copy link
Copy Markdown
Contributor

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

  • a developer is assigned
  • the PR is NOT estimated
  • the PR is labeled
  • the PR is NOT assigned to the current sprint
  • a meaningful title has been set according to https://www.conventionalcommits.org/
  • the PR is described in detail
  • the PR links to an issue
  • the PR has been reviewed

Add additional conditions here if necessary for this PR

fix: #182

@tonoizer tonoizer added Phase: Construction RUP: Implementation improvement Some layout / structure / performance optimization labels May 28, 2023
@tonoizer
tonoizer requested a review from Claiyc May 28, 2023 14:48
@tonoizer tonoizer self-assigned this May 28, 2023
@Claiyc

Claiyc commented May 30, 2023

Copy link
Copy Markdown
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

@Claiyc Claiyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tonoizer
tonoizer merged commit 323052d into main May 30, 2023
@tonoizer
tonoizer deleted the feat/182-improve-composable-conventions branch May 30, 2023 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Some layout / structure / performance optimization Phase: Construction RUP: Implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Composables to conventions

2 participants