Menu

📰
0

Signals in Vue (II): Interop, Async Patterns, SSR, and Common Pitfalls

DEV Community: vue·Luciano0322·about 1 month ago
#LHpkdNFN
#dev#fallback#class#code#strong#highlight
Reading 0:00
15s threshold

Quick Overview How watch / watchEffect should be split from our createEffect How to avoid leftover subscriptions/computed nodes during component remounts ( key changes) Two practical ways to handle async data, and how to optionally integrate with Vue Suspense Snapshot and subscription timing for SSR / Hydration Performance practices with equality comparison ( equals ) and normalized writes Common Vue pitfalls → corrected patterns watch / watchEffect : who should observe what? Guiding principles On the Vue side, only observe values ( ref s). Use useSignalRef() first to bridge a signal / computed into a Vue ref , then use watch / watchEffect . For data-layer side effects (requests, caching, logging), use our createEffect . Do not mix Vue’s tracking system into our dependency graph. Comparison example Anti-pattern: calling .get() directly inside watchEffect (double tracking) watchEffect (() => { console . log ( priceSig .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More