-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(tasks): refactor tasks store #76
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
Conversation
✅ Deploy Preview for chipper-wisp-c7553e ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
47eed6c
to
0c009f3
Compare
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 think this PR is on the right track. Well done on the introduction of vue-query too! 👏
Some of the topics we mentioned in the sync repo review (e.g. co-location of use-tasks-fetch, null vs undefined, etc) I've mostly omitted for this PR but of course feel free to begin applying them with this one or make a full repo-wide approach approach later.
0c009f3
to
c101f6a
Compare
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.
Thanks for the feedback!
Some of the applied changes went beyond the scope of the commented line. You can have a look at the corresponding commit to get the full picture.
I didn't refactor the topics mentioned in the sync in this PR since I didn't want to increase the scope. I will address those in a separate PR.
…store - Introduced the use-mutation composable to abstract common mutation logic - Refactored task store actions to utilize the use-mutation composable Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
- Refactored `moveTask` into 2 functions: - `optimisticallyUpdateTasksPositions`: optimistically updates tasks' priorities and columns based on provided parameters - `moveTask`: given a task, a column and an index, calculates the which tasks need to be updated and how, and calls optimisticallyUpdateTasksPositions - Refactored `refreshSpecificTasks` since it wasn't working properly with the aforementioned changes - Renamed some functions in `useTasksFetch` for better clarity Signed-off-by: Zacharias Fragkiadakis <[email protected]>
- Added a computed property to keep track of tasks without a priority - Updated the logic of when `initializePriority` is called to rely on the computed property rather than only run once after the tasks are fetched - Refactored `initializePriority`: - to use the computed property - to refresh all tasks on settled rather than only on success Signed-off-by: Zacharias Fragkiadakis <[email protected]>
- Refactored `resetPriority` to not make PATCH calls to update each task, instead, only update the local state of the tasks. This still triggers `initializePriority`, yielding the same result fo half the requests. - Updated `Reset Order` button: - it no longer indicates `resetPriority` is in progress as it is now synchronous - it now uses the same styles as the rest of the app's buttons Signed-off-by: Zacharias Fragkiadakis <[email protected]>
- Updated `initializePriority` to assign priorities to tasks without priority based on the highest priority in their respective columns Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
…ll tasks Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
… column Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
c101f6a
to
f87c5b4
Compare
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.
Well done, Zac! 👏
At some point, it may be worth covering some mission-critical store functions etc with tests too, but given that this is a refactoring PR and a long-standing one too, best to be tackled separately. We can talk about this with the PM.
If this approval becomes stale when fixing the CI issues and you need a re-review in a pinch don't hesitate to ping me on zulip.
Use said function to enforce switch switch statements handle all possible values Signed-off-by: Zacharias Fragkiadakis <[email protected]>
… computing it Signed-off-by: Zacharias Fragkiadakis <[email protected]>
Signed-off-by: Zacharias Fragkiadakis <[email protected]>
f87c5b4
to
caa02cf
Compare
Closes e0dbc12