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

Svelte 5: HMR only updates once #12506

Closed
henrikvilhelmberglund opened this issue Jul 19, 2024 · 9 comments
Closed

Svelte 5: HMR only updates once #12506

henrikvilhelmberglund opened this issue Jul 19, 2024 · 9 comments

Comments

@henrikvilhelmberglund
Copy link

henrikvilhelmberglund commented Jul 19, 2024

Describe the bug

Svelte 5: HMR only updates once.

Worked in 5.0.0-next.186, broken from 5.0.0-next.187.

Reproduction

https://stackblitz.com/github/henrikvilhelmberglund/svelte5-hmr-repro?file=src%2Froutes%2F%2Bpage.svelte
or
https://github.com/henrikvilhelmberglund/svelte5-hmr-repro

  1. ni && nr dev aka install and run dev
  2. Open +page.svelte
  3. Comment out the first p-tag.
  4. Verify that it disappears from the page.
  5. Comment out the second p-tag.
    Expected: It disappears from the page.
    Result: It doesn't disappear from the page.

If you F5 you can get one HMR again but nothing after that.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
    Memory: 3.34 GB / 15.95 GB
  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE     
    Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD     
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD        
    bun: 1.1.18 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (126.0.2592.102)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    svelte: 5.0.0-next.187 => 5.0.0-next.187

Severity

blocking an upgrade

@nicklozon
Copy link

Same issue here - first HMR update works, but nothing after.

Linking the problematic PR: #12454

@JLAcostaEC
Copy link

Same Here, a new project with tailwindcss the HMR only works once.

@HummingMind
Copy link

It's this:
#12403

Rich said they are aware and will fix when they have a chance to fix.

@henrikvilhelmberglund
Copy link
Author

It's this: #12403

Rich said they are aware and will fix when they have a chance to fix.

It's not the same, there are no components in the repro and that one started in next.179, this one in next.187. The PR causing this issue was linked above.

@XIYO
Copy link
Contributor

XIYO commented Jul 21, 2024

#12522 (comment)

is same issue?

@henrikvilhelmberglund
Copy link
Author

#12522 (comment)

is same issue?

Yep!

@Dart353
Copy link

Dart353 commented Jul 21, 2024

Hey all,

I am experiencing the same issue.

I started a new Svelte 5 project to test it out. I am currently running: "svelte": "5.0.0-next.191"

I am using the shadcn-svelte quickstart. Once I got all my components imported in, I started editing my root +page.svelte. I noticed the same issue that @henrikvilhelmberglund mentioned above.

I was going crazy trying to figure out the root cause of this. Good to see I'm not the only one experiencing the hmr issue.

For the time being, i'm going to roll back my svelte 5 version to: 5.0.0-next.186

dummdidumm added a commit that referenced this issue Jul 22, 2024
The previous HMR logic created a new wrapper and source per HMR update, which meant things would either get wrapped more and more (prior to #12454) or would not get updated after the first update because the reference to the original would get lost (after #12454).

This fixes that by creating a registry within the HMR wrappers by filename are stored, retrieved and its signals updated. That way nothing gets lost, and nothing gets wrapped more than needed.

Fixes #12506
@XIYO
Copy link
Contributor

XIYO commented Jul 22, 2024

193 still issue...😭

@dummdidumm
Copy link
Member

Fixed by #12547

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 a pull request may close this issue.

7 participants