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

Turbopack HMR does not work when using ternaries and JSX together. #69360

Open
heyitsarpit opened this issue Aug 27, 2024 · 0 comments
Open

Turbopack HMR does not work when using ternaries and JSX together. #69360

heyitsarpit opened this issue Aug 27, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Performance Anything with regards to Next.js performance. Turbopack Related to Turbopack with Next.js.

Comments

@heyitsarpit
Copy link

Link to the code that reproduces this issue

https://github.com/heyitsarpit/turbo-hmr-bug

To Reproduce

  1. Clone the repo provided
  2. run pnpm dev
  3. go to localhost:3000
  4. increment the counter on the screen
  5. edit text inHMR_Works.tsx
  6. edit text in HMR_Error.tsx
  7. observe the counter state after editing both files.

Current vs. Expected behavior

Expected behaviour: React state should not be reset after editing either HMR_Works.tsx or HMR_Error.tsx
Current behaviour: Editing HMR_Error.tsx causes a full page reload and the react state resets.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.17.0
  npm: 10.8.2
  Yarn: 1.22.19
  pnpm: 9.1.3
Relevant Packages:
  next: 14.2.6 // Latest available version is detected (14.2.6).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Performance, Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

I did not observe this behaviour with webpack. Also HMR keeps failing even if I comment out the ternary + JSX code.

@heyitsarpit heyitsarpit added the bug Issue was opened via the bug report template. label Aug 27, 2024
@github-actions github-actions bot added Performance Anything with regards to Next.js performance. Turbopack Related to Turbopack with Next.js. labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Performance Anything with regards to Next.js performance. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant