Skip to content
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

Optimistic query update on Tandai Sudah Dijawab #86

Closed
mazipan opened this issue Oct 16, 2023 · 0 comments · Fixed by #92
Closed

Optimistic query update on Tandai Sudah Dijawab #86

mazipan opened this issue Oct 16, 2023 · 0 comments · Fixed by #92

Comments

@mazipan
Copy link
Owner

mazipan commented Oct 16, 2023

Is your feature request related to a problem? Please describe.

Now we need to refetch all data when doing an update on Tandai Sudah Dijawab. Prefer using optimistic update

Describe the solution you'd like

https://tanstack.com/query/v4/docs/react/guides/optimistic-updates

@mazipan mazipan added enhancement New feature or request hacktoberfest labels Oct 16, 2023
@kodiakhq kodiakhq bot closed this as completed in #92 Oct 17, 2023
kodiakhq bot pushed a commit that referenced this issue Oct 17, 2023
Closes #86 

## Description
Applying optimistic update when marking question as done (following this pattern: https://tanstack.com/query/v4/docs/react/guides/optimistic-updates)


## Current Tasks
- [x] Move mark as done mutation to its own custom hook `useMarkQuestionAsDone`
- [x] Close dialog `onMutate` after performing optimistic update
- [x] Remove success `toast` and loading state on button since it is now not necessary as we're applying optimistic update
- [x] Remove `refetch` and `onRefetch` props in favor of `queryClient.invalidateQueries` 
- [x] Use `dialog` manager and apply same confirm dialog design as #87 for styling consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant