Skip to content

Changed $state randomly doesn't update the UI #15833

Open
@jnsmalm

Description

@jnsmalm

Describe the bug

I have a piece of html below ("totalWin" is a piece of $state on the "bet"-object) and most of the time the value updates as expected:

<div class="flex flex-col justify-center items-center">
  <div>
    Test
  </div>
  <div
    class={`text-xl font-normal`}
  >
    {currency.formatCurrency(bet.totalWin)}
  </div>
</div>

But sometimes (randomly?) it doesn't reflect the new value of "totalWin" state (on iOS Safari). I debugged this and removed more and more code until I found what caused it. If I instead change to the code to below it works always (the only changed thing is that I removed the "Test" text from the sibling html node):

<div class="flex flex-col justify-center items-center">
  <div>
   
  </div>
  <div
    class={`text-xl font-normal`}
  >
    {currency.formatCurrency(bet.totalWin)}
  </div>
</div>

How and why, you have any idea?

Reproduction

Sorry, this is a pretty big project.

Logs

System Info

System:
    OS: macOS 15.4.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 316.48 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    bun: 1.0.29 - ~/.bun/bin/bun
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 18.4
  npmPackages:
    svelte: ^5.0.0 => 5.28.2

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions