svelte-realtime 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vite.js +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-realtime",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "Realtime RPC and reactive subscriptions for SvelteKit, built on svelte-adapter-uws",
5
5
  "author": "Kevin Radziszewski",
6
6
  "license": "MIT",
package/vite.js CHANGED
@@ -552,13 +552,14 @@ function _generateSsrStubs(filePath, modulePath) {
552
552
 
553
553
  for (const name of storeNames) {
554
554
  if (dynamicNames.has(name)) {
555
- // Dynamic stream: return a readable store from a function so name(args) works during SSR
556
- lines.push(`const _${name} = (...args) => readable(undefined);`);
555
+ // Dynamic stream: factory returns a readable with .hydrate() for SSR rendering
556
+ lines.push(`const _${name} = (...args) => { const s = readable(undefined); s.hydrate = (d) => readable(d); return s; };`);
557
557
  lines.push(`_${name}.load = (platform, options) => __directCall(${safeModulePath(name)}, options?.args || [], platform, options);`);
558
558
  lines.push(`export { _${name} as ${name} };`);
559
559
  } else {
560
- // Static stream: plain readable store
560
+ // Static stream: readable with .hydrate() for SSR rendering
561
561
  lines.push(`const _${name} = readable(undefined);`);
562
+ lines.push(`_${name}.hydrate = (d) => readable(d);`);
562
563
  lines.push(`_${name}.load = (platform, options) => __directCall(${safeModulePath(name)}, options?.args || [], platform, options);`);
563
564
  lines.push(`export { _${name} as ${name} };`);
564
565
  }