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

Ensure all entries are cleared from cache on runtime change #20652

Merged
merged 4 commits into from
Jan 1, 2021

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 31, 2020

When leveraging webpack 5, a shared runtime chunk is used on the server between entries which is cleared in development when a change occurs. Currently not all entries are cleared when clearing the runtime chunk causing some entries to use a stale runtime chunk which breaks cases like using react context in multiple entries to break. This fixes it by ensuring all entries are cleared when the runtime chunk is cleared and adds a test to prevent regression.

Fixes: #18917

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk ijjk marked this pull request as ready for review January 1, 2021 00:13
@ijjk
Copy link
Member Author

ijjk commented Jan 1, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
buildDuration 11.9s 11.5s -345ms
nodeModulesSize 83 MB 83 MB ⚠️ +819 B
Page Load Tests Overall increase ✓
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
/ failed reqs 0 0
/ total time (seconds) 2.364 2.333 -0.03
/ avg req/sec 1057.36 1071.76 +14.4
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.67 1.616 -0.05
/error-in-render avg req/sec 1496.62 1547.19 +50.57
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
677f882d2ed8..2428.js gzip 12.9 kB 12.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-212f85f..f23b.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.2 kB 59.2 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-b862cd7..dba8.js gzip 1.64 kB 1.64 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.08 kB 8.08 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
index.html gzip 617 B 617 B
link.html gzip 622 B 622 B
withRouter.html gzip 610 B 610 B
Overall change 1.85 kB 1.85 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
buildDuration 13.5s 13.7s ⚠️ +244ms
nodeModulesSize 83 MB 83 MB ⚠️ +819 B
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
677f882d2ed8..2428.js gzip 12.9 kB 12.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-212f85f..f23b.js gzip 6.59 kB 6.59 kB
webpack-7193..1446.js gzip 751 B 751 B
Overall change 59.2 kB 59.2 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
polyfills-67..b7d1.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
_app-6220e08..9a40.js gzip 1.28 kB 1.28 kB
_error-4b0b5..2c91.js gzip 3.44 kB 3.44 kB
hooks-5f309a..7282.js gzip 887 B 887 B
index-57f580..c562.js gzip 227 B 227 B
link-b862cd7..dba8.js gzip 1.64 kB 1.64 kB
routerDirect..bd82.js gzip 303 B 303 B
withRouter-2..e384.js gzip 302 B 302 B
Overall change 8.08 kB 8.08 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary ijjk/next.js wp5-runtime-cache Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: da5e7e4

@Timer Timer changed the title Ensure all entries are cleared from cache when runtime is cleared Ensure all entries are cleared from cache on runtime change Jan 1, 2021
@Timer Timer merged commit 9c8d046 into vercel:canary Jan 1, 2021
@Timer Timer deleted the wp5-runtime-cache branch January 1, 2021 17:39

const Page = () => {
const idk = useIdk()

console.log(idk)
Copy link
Contributor

Choose a reason for hiding this comment

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

You left a console.log here 😉

Copy link
Member Author

@ijjk ijjk Jan 1, 2021

Choose a reason for hiding this comment

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

This was on purpose, it's to see when the test is failing while running since we can quickly see the null default value in the logs instead of waiting for the test to fail from checking the content

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context declared in _app undefined during SSR in dev
3 participants