dai-shi / react-suspense-fetch

[NOT MAINTAINED] A low-level library for React Suspense for Data Fetching
MIT License
296 stars 8 forks source link

feat: three cache types [BREAKING CHANGE] #19

Closed dai-shi closed 3 years ago

dai-shi commented 3 years ago

fix #18

This allows new cache type with custom comparator. The function signature is changed, so this is breaking change.

codesandbox-ci[bot] commented 3 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a2c3c98f95205c3f767c29744aa2da3d68e916b4:

Sandbox Source
React Configuration
React Typescript Configuration
dai-shi commented 3 years ago

@axelboc Would you try the codesandbox build (you can install it locally)? Also feel free to review code.

axelboc commented 3 years ago

Works like a charm! I was able to remove my wrapper store and just pass { type: 'Map', areEqual } with a tiny comparator function of my own making. I wasn't able to use zustand's shallow comparator because I want { foo: undefined; } to be considered the same as {}, which confirms the flexibility of the new API design.

All my tests are passing, and nothing jumps out from your code. Thanks a lot!! 🚀