-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[v9] feat(cache): promise based caching with workers #3245
base: v9
Are you sure you want to change the base?
Conversation
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 5e53956:
|
|
@CodyJasonBennett How can I check if this PR fixes the issue trying to be solved by #3243 ? |
I'll add tests once we can reproduce issues with error boundaries also. I don't expect that to be addressed here. |
// Apply loader extensions | ||
if (extensions) extensions(loader) |
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.
Is it possible to keep this and deopt calls to useLoader
with extensions
to only cache for the caller component? Can pass React.useId
to discern the component.
useLoader
in favor of passing in already extended loader instances.Caching was hidden behind
react-suspend
and did not offer any way to utilize browser APIs or extend it. This PR addsPromiseCache
class that creates a local cache compatible withReact.use
backed by the webCache
API. TheCache
API offers many benefits such as:fetch
.The
PromiseCache
accesses and processes resources from the global cache while handling promises for you.It looks like this when combined with
React.use
:TODO
Testing is broken.jest
doesn't mock theCache
API orfetch
. Trying to polyfill either proved harder than I expected.