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

bug: Persisted state doesn't update .current state in runes mode #235

Closed
ieedan opened this issue Mar 17, 2025 · 2 comments · Fixed by #236
Closed

bug: Persisted state doesn't update .current state in runes mode #235

ieedan opened this issue Mar 17, 2025 · 2 comments · Fixed by #236

Comments

@ieedan
Copy link
Contributor

ieedan commented Mar 17, 2025

Describe the bug

Just spent a lot more time than I am proud of trying to figure this out.

Earlier this morning I noticed that #225 and the subsequent release broke one of my selects in my application. I have since been trying to reproduce.

After a while I figured out that this bug for whatever reason only occurs in runes mode.

Basically the storage would update but the value of .current would not.

In other words this works:

<script lang="ts">  
    import Counter from "./counter.svelte";
    import { PersistedState } from 'runed'

    const count = new PersistedState<number>('count', 0);
</script>

<Counter bind:count={count.current}/>

This doesn't work:

<svelte:options runes/>

<script lang="ts">  
    import Counter from "./counter.svelte";
    import { PersistedState } from 'runed'

    const count = new PersistedState<number>('count', 0);
</script>

<Counter bind:count={count.current}/>

Reproduction

https://github.com/ieedan/runed-persisted-state-repro

Logs

N/A

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 16.85 GB / 31.73 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.13.0 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (134.0.3124.66)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @sveltejs/kit: ^2.16.0 => 2.19.2 
    runed: ^0.24.1 => 0.24.1 
    svelte: ^5.0.0 => 5.23.1

Severity

annoyance

@ieedan ieedan changed the title bug: Persisted state doesn't work with other state in the same script tag bug: Persisted state doesn't update .current with other state in the same script tag Mar 17, 2025
@ieedan

This comment has been minimized.

@ieedan

This comment has been minimized.

@ieedan ieedan changed the title bug: Persisted state doesn't update .current with other state in the same script tag bug: Persisted state doesn't update .current state in runes mode Mar 17, 2025
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.

1 participant