@abraca/dabra 0.4.0 → 0.5.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -417,29 +417,12 @@ export class AbracadabraProvider extends HocuspocusProvider {
417
417
  private async _doLoadChild(childId: string): Promise<AbracadabraProvider> {
418
418
  const childDoc = new Y.Doc({ guid: childId });
419
419
 
420
- if (this.isConnected) {
421
- // Online: notify the server that this child belongs to the parent and
422
- // wait for server confirmation before opening the child WebSocket.
423
- // Without waiting, the child's SyncStep1 may race against subdoc
424
- // creation and get a NotFound error on first sync.
425
- await new Promise<void>((resolve) => {
426
- const onRegistered = ({ childId: cid }: onSubdocRegisteredParameters) => {
427
- if (cid === childId) {
428
- this.off("subdocRegistered", onRegistered);
429
- resolve();
430
- }
431
- };
432
- this.on("subdocRegistered", onRegistered);
433
- this.registerSubdoc(childDoc);
434
- // Fallback: don't block forever if the server is slow or the
435
- // doc was already registered in a previous session.
436
- setTimeout(resolve, 3000);
437
- });
438
- } else {
439
- // Offline: queue the registration for replay on reconnect and proceed
440
- // immediately so the child provider can populate from its local store.
441
- this.registerSubdoc(childDoc);
442
- }
420
+ // Fire-and-forget: tell the server this child belongs to the parent.
421
+ // The child provider's own WebSocket handshake (TCP + TLS + auth) is
422
+ // slow enough that the server will have processed the registration
423
+ // before the child's first SyncStep1 arrives. In the rare race the
424
+ // child's built-in reconnect logic retries automatically.
425
+ this.registerSubdoc(childDoc);
443
426
 
444
427
  // Each child gets its own WebSocket connection. Omitting
445
428
  // websocketProvider lets HocuspocusProvider create one automatically