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

make HMR re-execute modules that self invalidate #5161

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

ForsakenHarmony
Copy link
Contributor

@ForsakenHarmony ForsakenHarmony commented Jun 1, 2023

Description

This can happen when a module that previously exported a React component no longer does, the next react refresh integration will then call module.hot.invalidate()

fixes the acceptance/ReactRefreshRequire.test.ts next.js integration test

@ForsakenHarmony ForsakenHarmony requested a review from a team as a code owner June 1, 2023 03:41
@vercel
Copy link

vercel bot commented Jun 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-designsystem-docs 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 5:54pm
examples-nonmonorepo 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 5:54pm
examples-svelte-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 5:54pm
8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
examples-cra-web ⬜️ Ignored (Inspect) Jun 1, 2023 5:54pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm
turbo-site ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2023 5:54pm

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

✅ This change can build next-swc

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

Linux Benchmark for bd7e186

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9145.81µs ± 41.33µs 9231.99µs ± 70.30µs +0.94%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8262.34µs ± 49.86µs 8128.33µs ± 58.89µs -1.62%
bench_startup/Turbopack CSR/1000 modules 893.66ms ± 1.61ms 896.15ms ± 4.19ms +0.28%

@ForsakenHarmony ForsakenHarmony force-pushed the hrmny/web-1136-hmr-fix-invalidate branch from a2a77d9 to 33cf929 Compare June 1, 2023 17:54
@@ -15,7 +15,7 @@

// This file must not use `import` and `export` statements. Otherwise, it
// becomes impossible to augment interfaces declared in `<reference>`d files
// (e.g. `Module`). Hence the need for `import()` here.
// (e.g. `Module`). Hence, the need for `import()` here.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

my IDE made a bunch of grammar suggestions 🙃

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

Linux Benchmark for c872103

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 4644.61µs ± 27.28µs 4636.93µs ± 39.20µs -0.17%
bench_hmr_to_eval/Turbopack CSR/1000 modules 4341.44µs ± 20.50µs 4419.69µs ± 115.61µs +1.80%
bench_startup/Turbopack CSR/1000 modules 709.77ms ± 1.41ms 712.52ms ± 2.03ms +0.39%

@ForsakenHarmony ForsakenHarmony merged commit 6f907ec into main Jun 1, 2023
@ForsakenHarmony ForsakenHarmony deleted the hrmny/web-1136-hmr-fix-invalidate branch June 1, 2023 23:51
@@ -15,7 +15,7 @@

// This file must not use `import` and `export` statements. Otherwise, it
// becomes impossible to augment interfaces declared in `<reference>`d files
// (e.g. `Module`). Hence the need for `import()` here.
// (e.g. `Module`). Hence, the need for `import()` here.
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL!

* Removes a module from a chunk. Returns true there are no remaining chunks
* including this module.
* Removes a module from a chunk.
* Returns `true` if there are no remaining chunks, including this module.
Copy link
Contributor

@alexkirsz alexkirsz Jun 5, 2023

Choose a reason for hiding this comment

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

This no longer means the same thing. It should be:

Returns `true` if there are no remaining chunks including this module.

(the chunks include a module)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, will fix in my next PR

ForsakenHarmony added a commit to vercel/next.js that referenced this pull request Jul 25, 2024
### Description
This can happen when a module that previously exported a React component
no longer does, the next react refresh integration will then call
`module.hot.invalidate()`

fixes the `acceptance/ReactRefreshRequire.test.ts` next.js integration
test
ForsakenHarmony added a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description
This can happen when a module that previously exported a React component
no longer does, the next react refresh integration will then call
`module.hot.invalidate()`

fixes the `acceptance/ReactRefreshRequire.test.ts` next.js integration
test
ForsakenHarmony added a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description
This can happen when a module that previously exported a React component
no longer does, the next react refresh integration will then call
`module.hot.invalidate()`

fixes the `acceptance/ReactRefreshRequire.test.ts` next.js integration
test
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.

3 participants