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

Force dev server clients to revalidate assets and use if-last-modified #8166

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented May 29, 2022

Closes #7546

Set Cache-Control: max-age=0, must-revalidate. AFAICT, this effectively means "never reuse cached assets".

For files in the dist dir, we already send a last-modified header for assets, so send 304s in case they haven't changed.
For all other endpoints, it will just send the full response (and behave like no-store).

Not sure if we want to add tests for this...

Webpack (or at least create-react-app) does the same thing, but based on etags instead of mtime.

@parcel-benchmark
Copy link

Benchmark Results

Kitchen Sink 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

React HackerNews ✅

Timings

Description Time Difference
Cold 9.11s -17.00ms
Cached 452.00ms +12.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

Bundle Size Difference Time Difference
dist/logo.c5bb83f1.png 246.00b +0.00b 4.74s +669.00ms ⚠️

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.59m -297.00ms
Cached 2.46s -82.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Three.js ✅

Timings

Description Time Difference
Cold 6.57s +29.00ms
Cached 282.00ms +7.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@devongovett devongovett merged commit d629007 into v2 Jun 7, 2022
@devongovett devongovett deleted the dev-server-304 branch June 7, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code changes saved are not reflected unless a hard refresh is made
3 participants