@atlaskit/editor-synced-block-provider 8.1.9 → 8.2.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.
@@ -80,3 +80,32 @@ export type SyncBlockPrefetchData = {
80
80
  prefetchPromise: Promise<SyncBlockInstance[] | undefined>;
81
81
  resourceIds: string[];
82
82
  };
83
+ /**
84
+ * Helpers to distinguish "data provider not ready / torn down" from a genuine
85
+ * fetch/subscribe failure (EDITOR-7860). On Jira the provider is wired
86
+ * asynchronously and `destroy()` nulls it on orphaned managers, so queued/
87
+ * in-flight ops throw `Data provider not set` — previously mis-logged as a real
88
+ * error. These let throw and catch sites agree on one non-string-matched signal
89
+ * so the residual false errors are suppressed. Gated by
90
+ * `platform_editor_blocks_patch_3`.
91
+ *
92
+ * NB: these intentionally live here rather than in a dedicated module to avoid
93
+ * adding a downstream file to consuming Jira packages' Thunderstone complexity.
94
+ */
95
+ /** Legacy message — kept identical for gate-off and historical events. */
96
+ export declare const PROVIDER_NOT_READY_MESSAGE = "Data provider not set";
97
+ /**
98
+ * Thrown when a fetch/subscribe runs against a manager whose provider is not
99
+ * (yet) available or torn down. Keeps the legacy message + name so string
100
+ * matchers still work, while new code uses {@link isProviderNotReadyError}.
101
+ */
102
+ export declare class ProviderNotReadyError extends Error {
103
+ readonly isProviderNotReadyError = true;
104
+ constructor(message?: string);
105
+ }
106
+ /**
107
+ * True when the value is a "provider not ready / torn down" condition, not a
108
+ * genuine failure. Recognises the tagged {@link ProviderNotReadyError} and the
109
+ * legacy message (for errors thrown before rollout).
110
+ */
111
+ export declare const isProviderNotReadyError: (error: unknown) => boolean;
@@ -31,6 +31,14 @@ export declare class ReferenceSyncBlockStoreManager {
31
31
  private _batchFetcher;
32
32
  constructor(dataProvider?: SyncBlockDataProviderInterface, viewMode?: ViewMode);
33
33
  isReferenceBlock(node: PMNode): boolean;
34
+ /**
35
+ * Whether the async data provider is wired and the manager is not torn down.
36
+ * Consumers gate fetch/subscribe on this to avoid a false `Data provider not
37
+ * set` fetch error (EDITOR-7860). The `isDestroyed` check covers managers
38
+ * orphaned mid-flight during an async provider swap, where `dataProvider`
39
+ * alone is insufficient.
40
+ */
41
+ hasDataProvider(): boolean;
34
42
  /**
35
43
  * Enables or disables real-time GraphQL subscriptions for block updates.
36
44
  * When enabled, the store manager will subscribe to real-time updates
@@ -7,6 +7,13 @@ export interface SyncBlockBatchFetcherDeps {
7
7
  getSubscriptions: () => Map<ResourceId, {
8
8
  [localId: BlockInstanceId]: SubscriptionCallback;
9
9
  }>;
10
+ /**
11
+ * Returns true when the data provider is wired and not torn down. When false,
12
+ * the fetcher skips and re-queues so the IDs are fetched once ready, avoiding
13
+ * the false `Data provider not set` errors (EDITOR-7860). Optional; when
14
+ * omitted, behaviour is unchanged.
15
+ */
16
+ isProviderReady?: () => boolean;
10
17
  }
11
18
  /**
12
19
  * Handles debounced batch-fetching of sync block data via `raf-schd`.
@@ -33,8 +33,12 @@ export declare class SyncBlockSubscriptionManager {
33
33
  private static readonly INITIAL_RETRY_DELAY_MS;
34
34
  private static readonly RETRY_BACKOFF_MULTIPLIER;
35
35
  private static readonly MAX_RETRY_ATTEMPTS;
36
+ private static readonly MAX_RETRY_ATTEMPTS_HARDENED;
37
+ private static readonly MAX_RETRY_DELAY_MS;
36
38
  private retryAttempts;
37
39
  private pendingRetries;
40
+ private getMaxRetryAttempts;
41
+ private getReconnectionDelay;
38
42
  constructor(deps: SyncBlockSubscriptionManagerDeps);
39
43
  /**
40
44
  * Returns the subscriptions map. Used by external consumers (e.g. batch fetcher, flush)
@@ -62,11 +66,6 @@ export declare class SyncBlockSubscriptionManager {
62
66
  * stale entry and scheduling a reconnection with exponential backoff.
63
67
  */
64
68
  private handleSubscriptionTerminated;
65
- /**
66
- * Schedules a reconnection attempt with exponential backoff.
67
- * Delay = INITIAL_RETRY_DELAY_MS * (RETRY_BACKOFF_MULTIPLIER ^ attempts)
68
- * e.g. 1s, 2s, 4s, 8s, 16s
69
- */
70
69
  private scheduleReconnection;
71
70
  /**
72
71
  * Resets the retry counter for a resource. Called when a successful
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "uuid": "^3.1.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@atlaskit/editor-common": "^116.13.0",
33
+ "@atlaskit/editor-common": "^116.15.0",
34
34
  "react": "^18.2.0"
35
35
  },
36
36
  "devDependencies": {
@@ -74,7 +74,7 @@
74
74
  }
75
75
  },
76
76
  "name": "@atlaskit/editor-synced-block-provider",
77
- "version": "8.1.9",
77
+ "version": "8.2.0",
78
78
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
79
79
  "author": "Atlassian Pty Ltd",
80
80
  "license": "Apache-2.0",