-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Use cache in the fixture #20303
Use cache in the fixture #20303
Conversation
@@ -10,10 +11,13 @@ function resolve(path) { | |||
} | |||
|
|||
module.exports = async function(req, res) { | |||
CacheContext._currentValue = createCache(); |
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.
Essentially a global now. But it should probably be created by the server itself (?)
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 94543c8:
|
3d69372
to
9a29464
Compare
Details of bundled changes.Comparing: 89d4fe1...94543c8 react-test-renderer
react-dom
react-native-renderer
react-transport-dom-relay
react-transport-native-relay
react-art
react-server
react-transport-dom-webpack
react-reconciler
react-debug-tools
ReactDOM: size: 0.0%, gzip: 🔺+0.1% Size changes (experimental) |
Details of bundled changes.Comparing: 89d4fe1...94543c8 react-test-renderer
react-dom
react-native-renderer
react-transport-dom-relay
react-transport-native-relay
react-art
react-server
react-transport-dom-webpack
react-reconciler
react-debug-tools
ReactDOM: size: 🔺+0.2%, gzip: 🔺+0.1% Size changes (stable) |
for (var key in require.cache) { | ||
delete require.cache[key]; | ||
} | ||
// for (var key in require.cache) { |
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.
ESM breaks this
Remove the actual implementation so we can fill it in from scratch. We'll be starting with the server one but for now let's make both throw. Also remove the cache entry point in the React package for now. Because it will go through the dispatcher. The fetch test still fails and our fixture does, too. I'll fix them next.
This implements a naive readCache() in the Flight Server environment only. It lets us fix up the NodeFetch test to use Server Components.
Cleaned up and resubmitted as #20315 |
Doesn't yet add necessary APIs. But it hooks the cache up to the fixture. Fetching works.
This adds
readCache
to the dispatcher. Currently it's copy pasta fromreadContext
and actually requires passing in the context. This would be fixed later on. For now I just need an injection mechanism that's usable on the client but doesn't throw in the Flight Server environment. It would be replaced by dedicated Hooks that will also let us remove the cache entry point.