@shaxpir/duiduidui-models 1.6.18 → 1.6.19

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.
@@ -156,7 +156,17 @@ class ShareSync {
156
156
  }
157
157
  }
158
158
  createConnectionWithDurableStore(socket, options) {
159
- return new client_1.Connection(socket, {
159
+ const shareSync = this;
160
+ // Create a wrapper callback that ensures it's called even when offline
161
+ let readyCallbackInvoked = false;
162
+ const wrappedCallback = options.onReadyCallback ? function () {
163
+ if (!readyCallbackInvoked) {
164
+ readyCallbackInvoked = true;
165
+ shareSync._debug && console.log('[ShareSync] DurableStore ready, invoking onReadyCallback');
166
+ options.onReadyCallback();
167
+ }
168
+ } : undefined;
169
+ const connection = new client_1.Connection(socket, {
160
170
  durableStore: {
161
171
  storage: this._storage,
162
172
  debug: this._debug,
@@ -170,9 +180,20 @@ class ShareSync {
170
180
  }
171
181
  return null;
172
182
  },
173
- onReadyCallback: options.onReadyCallback
183
+ onReadyCallback: wrappedCallback
174
184
  }
175
185
  });
186
+ // Add a fallback timeout to ensure the callback fires even if the DurableStore
187
+ // ready event doesn't properly trigger when offline
188
+ if (wrappedCallback && !shareSync._socketIsOpen) {
189
+ setTimeout(function () {
190
+ if (!readyCallbackInvoked) {
191
+ console.warn('[ShareSync] Socket offline - forcing onReadyCallback after timeout');
192
+ wrappedCallback();
193
+ }
194
+ }, 100); // Small delay to allow normal initialization first
195
+ }
196
+ return connection;
176
197
  }
177
198
  async initializeDurableStore(options) {
178
199
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"
@@ -21,7 +21,6 @@
21
21
  "@shaxpir/shaxpir-common": "1.4.0",
22
22
  "ot-json1": "1.0.1",
23
23
  "ot-text-unicode": "4.0.0",
24
- "react-native-popover-view": "^6.1.0",
25
24
  "reconnecting-websocket": "4.4.0"
26
25
  },
27
26
  "devDependencies": {