Replies: 3 comments 5 replies
-
I have also another scenario: Micro-frontends. Since currently the Svelte runtime cannot be easily dedupped across projects, stores remain the champions as they react across MFE's. I also think that stores should not be deprecated and should continue to be a core feature of Svelte. |
Beta Was this translation helpful? Give feedback.
-
But there are no talks about even deprecating them. Stores just became a niche solution. |
Beta Was this translation helpful? Give feedback.
-
Creating a class with state wouldn't work? Or having a closure over the state? Not sure what that long function is doing internally so maybe I'm misunderstanding |
Beta Was this translation helpful? Give feedback.
-
In Overwolf apps (gaming overlays/tools), we often need multiple windows:
Each window is a separate JavaScript context, which creates a fundamental challenge for reactivity systems.
Why Fine-Grained Reactivity Falls Short Here
While runes provide elegant fine-grained reactivity within a single window, they can't naturally span multiple JavaScript contexts:
The fine-grained reactivity that makes runes so elegant works beautifully within a window, but stops at window boundaries.
Why Stores Are Essential
The subscription model that underpins Svelte stores solves this exact problem:
Stores work across windows because:
.subscribe()
method creates a clear API contract$
prefix makes working with stores almost as convenient as using local stateThe Future-Proof Solution
While runes provide an elegant solution for most use cases, subscription-based stores solve problems that fine-grained reactivity fundamentally cannot. Ideally, Svelte would:
The Alternative Is Painful
Without stores, developers in cross-window scenarios would need to:
$
syntaxThere's also the option of using shared local storage with storage events for sync but that's a less elegant solution that just using stores
Beta Was this translation helpful? Give feedback.
All reactions