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

useCachedPromise: Fix optimisticUpdate not working when paginating beyond the first page. #27

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

sxn
Copy link
Contributor

@sxn sxn commented Mar 15, 2024

Description

Because useCachedPromise doesn't cache beyond the first page, optimisticUpdate also doesn't work as expected once you paginate further. This PR:

  • changes useCachedPromise so that it only overwrites the usePromise's mutate option if we're not paginating, or if we're on the first page.
  • updates all -paginated smoke tests to include a Delete all Items But This One action, in order to test optimisticUpdate

Screencast

Before:

Screen.Recording.2024-03-15.at.16.23.53.mov

After:

Screen.Recording.2024-03-15.at.16.24.20.mov

@sxn sxn requested a review from mathieudutour March 15, 2024 15:28
Copy link
Member

@mathieudutour mathieudutour left a comment

Choose a reason for hiding this comment

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

Makes sense 👍

@sxn sxn force-pushed the optimistic-update-pagination branch from d57e6c3 to 728c8d2 Compare March 18, 2024 09:08
@sxn sxn merged commit b4ec572 into main Mar 18, 2024
1 check passed
@sxn sxn deleted the optimistic-update-pagination branch March 18, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants