Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

@hmr directives no longer work #12985

Closed
TheFireBlast opened this issue Nov 10, 2024 · 1 comment · Fixed by #12988
Closed

@hmr directives no longer work #12985

TheFireBlast opened this issue Nov 10, 2024 · 1 comment · Fixed by #12988
Labels
documentation Improvements or additions to documentation

Comments

@TheFireBlast
Copy link

Describe the bug

In previous versions of SvelteKit, one could preserve local component state using certain directives inside comments, these being // @hmr:keep (used before or beside a variable declaration) and // @hmr:keep-all (which applies to all variables).
Currently, these directives are no longer respected even though the documentation still references them, and there is no notice I could find saying this behavior would be removed.

svelte-hmr

I believe this is caused by the dropping of svelte-hmr in favor of having hmr built into Svelte 5, which seems to not have implemented this feature, so, sorry in advance if I were actually supposed to have opened this issue in the svelte repo instead.

Reproduction

OLD: https://stackblitz.com/edit/stackblitz-starters-tbnujh?file=src%2Froutes%2F%2Bpage.svelte
CURRENT: https://stackblitz.com/edit/sveltejs-kit-template-default-ncwrwc?file=src%2Froutes%2F%2Bpage.svelte

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
    Memory: 643.30 MB / 7.91 GB
  Binaries:
    Node: 20.15.0 - ~\AppData\Local\pnpm\node.EXE
    npm: 10.7.0 - ~\AppData\Local\pnpm\npm.CMD
    pnpm: 9.12.3 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @sveltejs/adapter-auto: ^3.3.1 => 3.3.1
    @sveltejs/kit: ^2.8.0 => 2.8.0
    @sveltejs/vite-plugin-svelte: 4.0.0-next.7 => 4.0.0-next.7
    svelte: ^5.1.13 => 5.1.13
    vite: ^5.4.10 => 5.4.10

Severity

annoyance

Additional Information

No response

@Conduitry Conduitry added the documentation Improvements or additions to documentation label Nov 10, 2024
@benmccann
Copy link
Member

I've sent a PR to remove that FAQ since it was so outdated. If those are features that you were relying on, I'd suggest filing a feature request over at https://github.com/sveltejs/svelte/issues

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants