Skip to content

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

Closed
@ieedan

Description

@ieedan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions