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

Bring in react-suspense-fetch into codebase #1660

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jun 5, 2024

Since react-suspense-fetch is no longer maintained but provides a good abstraction for our data providers (probably even after the next React 19 upgrade), and since we would really benefit from being able to introspect the internal cache of the valueStore to address #1578 properly once and for all, I bring in the library's source code into our codebase.

Of course, I also tweak it to my liking a bit:

  • I swap the Input and Result generics (<Result, Input> just felt unnecessarily confusing).
  • I remove the restriction to always have to call prefetch before get.
  • I take advantage of the new preset method, which was added in a recent version we hadn't upgraded to because of the previous point, to remove our own cache for group children in DataProvider.

In my next PR, I'll try to use the stores' built-in features to cancel requests and evict aborted responses from the cache, instead of our own complicated code in DataProviderApi.

@axelboc axelboc force-pushed the integrate-react-suspense-fetch branch from 195d1f2 to 9ce863d Compare June 5, 2024 08:10
@axelboc axelboc requested a review from loichuder June 5, 2024 08:18
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

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

Man, the preset addition is so nice 👍

@axelboc axelboc force-pushed the integrate-react-suspense-fetch branch from 9ce863d to 564b3c1 Compare June 5, 2024 14:21
@axelboc axelboc force-pushed the integrate-react-suspense-fetch branch from 564b3c1 to 5fc9639 Compare June 6, 2024 06:51
@axelboc axelboc merged commit 01c768a into main Jun 6, 2024
8 checks passed
@axelboc axelboc deleted the integrate-react-suspense-fetch branch June 6, 2024 06:54
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