diff --git a/packages/next/client/index.tsx b/packages/next/client/index.tsx index 8115aab7519d6..3e408f1cefe6c 100644 --- a/packages/next/client/index.tsx +++ b/packages/next/client/index.tsx @@ -775,9 +775,11 @@ if (process.env.__NEXT_RSC) { serialized?: string _fresh?: boolean }) => { + React.useEffect(() => { + rscCache.delete(cacheKey) + }) const response = useServerResponse(cacheKey, serialized) const root = response.readRoot() - rscCache.delete(cacheKey) return root } diff --git a/test/integration/react-streaming-and-server-components/app/next.config.js b/test/integration/react-streaming-and-server-components/app/next.config.js index ae1bd8cf8ebc6..add280d239bb3 100644 --- a/test/integration/react-streaming-and-server-components/app/next.config.js +++ b/test/integration/react-streaming-and-server-components/app/next.config.js @@ -1,6 +1,7 @@ const withReact18 = require('../../react-18/test/with-react-18') module.exports = withReact18({ + reactStrictMode: true, onDemandEntries: { maxInactiveAge: 1000 * 60 * 60, },