svelte-5.53.8-scheduler-deadlock Svelte Themes

Svelte 5.53.8 Scheduler Deadlock

Minimal reproduction for Svelte 5.53.8 scheduler deadlock regression

Svelte 5.53.8 Scheduler Deadlock

Minimal reproduction for a scheduler deadlock regression in Svelte 5.53.8.

Bug Summary

A store getter that lazily writes $state on first read deadlocks the Svelte scheduler when that getter is read inside a template binding during the flush/commit phase. The UI freezes permanently — no errors in console, no stack overflow, no crash.

  • Affects: Svelte 5.53.8, 5.53.9 (and presumably later)
  • Works in: Svelte 5.53.7
  • Likely cause: PR #17805 "simplify scheduling logic"

Steps to Reproduce

npm install
npm run dev
  1. Click "Open panel" — the panel opens, showing width info
  2. Click "Counter" — the counter does not update. The UI is frozen.
  3. No errors in the console. The scheduler is silently deadlocked.

Verify the Fix

Change svelte to 5.53.7 in package.json, reinstall, repeat — everything works.

Root Cause

The store.svelte.js exports a getter that writes $state on first read:

get panelWidth () {
  if (panelWidth === null) panelWidth = DEFAULT_WIDTH  // writes $state!
  return panelWidth
}

When this getter is read during the commit phase (via a style:width binding), the $state mutation stalls the scheduler in 5.53.8+.

Workaround

Use nullish coalescing instead of assignment:

get panelWidth () {
  return panelWidth ?? DEFAULT_WIDTH  // no state write
}

Top categories

Loading Svelte Themes