@pilotiq/pilotiq 0.23.0 → 0.23.1

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.
@@ -1,8 +1,8 @@
1
1
 
2
- > @pilotiq/pilotiq@0.23.0 build /home/runner/work/pilotiq/pilotiq/packages/pilotiq
2
+ > @pilotiq/pilotiq@0.23.1 build /home/runner/work/pilotiq/pilotiq/packages/pilotiq
3
3
  > tsc -p tsconfig.build.json && pnpm run copy-assets
4
4
 
5
5
 
6
- > @pilotiq/pilotiq@0.23.0 copy-assets /home/runner/work/pilotiq/pilotiq/packages/pilotiq
6
+ > @pilotiq/pilotiq@0.23.1 copy-assets /home/runner/work/pilotiq/pilotiq/packages/pilotiq
7
7
  > mkdir -p dist/styles && cp -R src/styles/*.css dist/styles/
8
8
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pilotiq/pilotiq
2
2
 
3
+ ## 0.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8068822: fix(collab): `useCollabSeed` runs the seedFn for legacy rooms without `.synced`
8
+
9
+ The Phase 6d migration (`useCollabSeed` consumes the modern `room.synced` Promise stamped by `@pilotiq-pro/collab@>=0.2`'s `<RecordCollabRoom>`) intentionally short-circuited rooms without `.synced` by setting `seeded=true` with no callback fired — the assumption was that legacy providers had already gated first-sync via `onProviderSynced` themselves. But that posture broke adapters that fully migrated TO `useCollabSeed` and stopped calling `onProviderSynced` directly: when the room owner ships a custom provider that doesn't stamp `.synced`, the editor's empty `Y.XmlFragment` never picked up the SSR-rendered `defaultValue`, and the editor's mount-time `onChange('')` then clobbered the hidden FormData input that holds the server-loaded value.
10
+
11
+ Fix: in the no-`.synced` branch, run the seedFn immediately (wrapped in `ydoc.transact(..., 'pilotiq-collab-seed')` when possible, same as the synced path) before flipping `seeded=true` — treat "no Promise" as "already synced." Idempotent + best-effort: any throw from the seed callback is swallowed (the seed is allowed to fail when the share-type is unavailable, mirroring the synced path's `try/catch`).
12
+
13
+ Doesn't fix the parallel pilotiq-pro `FormCollabBinding` regression where the binding seeds the form's Y.Map with empty strings (that's the failing `relationship-pk-switch.spec.ts` case — `RecordCollabRoom` stamps `.synced`, so this branch never runs there); fix lives at the binding layer.
14
+
3
15
  ## 0.23.0
4
16
 
5
17
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"useCollabSeed.d.ts","sourceRoot":"","sources":["../../src/react/useCollabSeed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAK,UAAU,GAAG,IAAI,EAC1B,GAAG,EAAM,MAAM,EACf,MAAM,EAAG,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAC9B,OAAO,CA2CT"}
1
+ {"version":3,"file":"useCollabSeed.d.ts","sourceRoot":"","sources":["../../src/react/useCollabSeed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAK,UAAU,GAAG,IAAI,EAC1B,GAAG,EAAM,MAAM,EACf,MAAM,EAAG,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAC9B,OAAO,CAwDT"}
@@ -29,12 +29,27 @@ export function useCollabSeed(room, key, seedFn) {
29
29
  setSeeded(false);
30
30
  return;
31
31
  }
32
- // Legacy rooms without `.synced` — the room owner is on the hook
33
- // for whatever first-sync gating they used to do via
34
- // `onProviderSynced`. Mark seeded immediately so the consumer
35
- // can mount without a placeholder. No seedFn runs.
32
+ // Legacy rooms without `.synced` — the room owner did its own first-
33
+ // sync gating (typically `onProviderSynced` inside `<RecordCollabRoom>`).
34
+ // Adapters that migrated to `useCollabSeed` still need the seedFn to
35
+ // run, otherwise an empty Y.XmlFragment never picks up the SSR-rendered
36
+ // `defaultValue` — and the editor's mount-time `onChange('')` clobbers
37
+ // the hidden FormData input. Run the seedFn immediately (treat as
38
+ // already-synced); the room owner's prior gating is assumed to have
39
+ // resolved by the time the React mount effect fires.
36
40
  const syncedPromise = room.synced;
37
41
  if (!syncedPromise) {
42
+ try {
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ const ydoc = room.ydoc;
45
+ if (ydoc && typeof ydoc.transact === 'function') {
46
+ ydoc.transact(() => seedFnRef.current(ydoc), SEED_ORIGIN);
47
+ }
48
+ else {
49
+ seedFnRef.current(ydoc);
50
+ }
51
+ }
52
+ catch { /* ignore — seed is best-effort */ }
38
53
  setSeeded(true);
39
54
  return;
40
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useCollabSeed.js","sourceRoot":"","sources":["../../src/react/useCollabSeed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnD,MAAM,WAAW,GAAG,qBAAqB,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CAC3B,IAA0B,EAC1B,GAAe,EACf,MAA+B;IAE/B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,SAAS,CAAC,KAAK,CAAC,CAAA;YAChB,OAAM;QACR,CAAC;QACD,iEAAiE;QACjE,qDAAqD;QACrD,8DAA8D;QAC9D,mDAAmD;QACnD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAA;QACjC,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,SAAS,CAAC,IAAI,CAAC,C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,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAA;gBAC3D,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBACzB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC,CAAC,kCAAkC,CAAC,CAAC;YAC9C,SAAS,CAAC,IAAI,CAAC,CAAA;QACjB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACZ,+DAA+D;YAC/D,sDAAsD;YACtD,IAAI,CAAC,SAAS;gBAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA,CAAC,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAEf,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilotiq/pilotiq",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "View-based admin panel for RudderJS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,12 +37,25 @@ export function useCollabSeed(
37
37
  setSeeded(false)
38
38
  return
39
39
  }
40
- // Legacy rooms without `.synced` — the room owner is on the hook
41
- // for whatever first-sync gating they used to do via
42
- // `onProviderSynced`. Mark seeded immediately so the consumer
43
- // can mount without a placeholder. No seedFn runs.
40
+ // Legacy rooms without `.synced` — the room owner did its own first-
41
+ // sync gating (typically `onProviderSynced` inside `<RecordCollabRoom>`).
42
+ // Adapters that migrated to `useCollabSeed` still need the seedFn to
43
+ // run, otherwise an empty Y.XmlFragment never picks up the SSR-rendered
44
+ // `defaultValue` — and the editor's mount-time `onChange('')` clobbers
45
+ // the hidden FormData input. Run the seedFn immediately (treat as
46
+ // already-synced); the room owner's prior gating is assumed to have
47
+ // resolved by the time the React mount effect fires.
44
48
  const syncedPromise = room.synced
45
49
  if (!syncedPromise) {
50
+ try {
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ const ydoc = room.ydoc as any
53
+ if (ydoc && typeof ydoc.transact === 'function') {
54
+ ydoc.transact(() => seedFnRef.current(ydoc), SEED_ORIGIN)
55
+ } else {
56
+ seedFnRef.current(ydoc)
57
+ }
58
+ } catch { /* ignore — seed is best-effort */ }
46
59
  setSeeded(true)
47
60
  return
48
61
  }