Skip to content

Derived value not receiving updates #16090

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

Open
tBuLi12 opened this issue Jun 5, 2025 · 4 comments · May be fixed by #16110
Open

Derived value not receiving updates #16090

tBuLi12 opened this issue Jun 5, 2025 · 4 comments · May be fixed by #16110
Labels
p0 stuff we should fix ASAP
Milestone

Comments

@tBuLi12
Copy link

tBuLi12 commented Jun 5, 2025

Describe the bug

When a value twice derived is used in a computed expression which is the value of a prop/argument of a component/snippet with a default value it may not always receive updates when the underlying state changes. Please see the reproduction section for more details.

Occurs in versions 5.19.5 and above.

Reproduction

See minimal reproducible example in the repls below:

Displays 0, incorrect
[email protected]

Displays 1, correct
[email protected]

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (32) x64 AMD Ryzen 9 9950X 16-Core Processor
    Memory: 34.45 GB / 61.58 GB
  Binaries:
    bun: 1.2.13 - ~\AppData\Local\Temp\bun-node-64ed68c9e\bun.EXE
  Browsers:
    Edge: Chromium (136.0.3240.50)
  npmPackages:
    svelte: ^5.33.14 => 5.33.14

Severity

blocking an upgrade

@dummdidumm dummdidumm added the p0 stuff we should fix ASAP label Jun 5, 2025
@dummdidumm dummdidumm added this to the 5.x milestone Jun 5, 2025
@raythurnvoid
Copy link
Contributor

This PR introduced this regression: #15137

@raythurnvoid
Copy link
Contributor

This seems much more nasty than what i thought and the issue seems to be reproducible only in dev mode. (pnpm run dev)

In production mode the app behaves as expected. (pnpm run build && pnpm run preview)

@tBuLi12
Copy link
Author

tBuLi12 commented Jun 9, 2025

the issue seems to be reproducible only in dev mode

That's odd, I remember experiencing it in prod mode as well. I was using the esbuild svelte plugin tho, maybe it passes dev: true to the svelte compiler by default. Or maybe causing this in production requires more steps, which I've lost when minimizing the example in dev mode.

@raythurnvoid
Copy link
Contributor

raythurnvoid commented Jun 9, 2025

Try again perhaps, svelte codebase changed since then so maybe the issue got fixed indirectly but only in prod mode that sounds weird to me as well.

What i did was: create svelte proj with pnpm create vite then pnpm install > pnpm run build > pnpm run preview and the UI shows "1" (correct)

Only pnpm run dev shows "0" (incorrect).

The way i found out about this is because i was unable to write a test in svelte that would fail for this case and then i forced dev: true and magically the test was now failing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0 stuff we should fix ASAP
Projects
None yet
3 participants