@liveblocks/client 0.18.2 → 0.18.3

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 +1 @@
1
- 19cb31b448a235c276f9eb3510d2dfa93f4af74e
1
+ fb9811ab760d208663f68c35b2180d2133a5ef65
package/index.js CHANGED
@@ -245,6 +245,9 @@ function isConnectionSelfAware(connection) {
245
245
  return connection.state === "open" || connection.state === "connecting";
246
246
  }
247
247
  function makeStateMachine(state, config, mockedEffects) {
248
+ var _a;
249
+ const doNotBatchUpdates = (cb) => cb();
250
+ const batchUpdates = (_a = config.unstable_batchedUpdates) != null ? _a : doNotBatchUpdates;
248
251
  const pool = {
249
252
  roomId: config.roomId,
250
253
  getNode: (id) => state.nodes.get(id),
@@ -267,10 +270,12 @@ function makeStateMachine(state, config, mockedEffects) {
267
270
  });
268
271
  activeBatch.reverseOps.push(...reverse);
269
272
  } else {
270
- addToUndoStack(reverse);
271
- state.redoStack = [];
272
- dispatchOps(ops);
273
- notify({ storageUpdates });
273
+ batchUpdates(() => {
274
+ addToUndoStack(reverse, doNotBatchUpdates);
275
+ state.redoStack = [];
276
+ dispatchOps(ops);
277
+ notify({ storageUpdates }, doNotBatchUpdates);
278
+ });
274
279
  }
275
280
  }
276
281
  };
@@ -335,12 +340,12 @@ function makeStateMachine(state, config, mockedEffects) {
335
340
  presence: me
336
341
  } : null
337
342
  );
338
- function createOrUpdateRootFromMessage(message) {
343
+ function createOrUpdateRootFromMessage(message, batchedUpdatesWrapper) {
339
344
  if (message.items.length === 0) {
340
345
  throw new Error("Internal error: cannot load storage without items");
341
346
  }
342
347
  if (state.root) {
343
- updateRoot(message.items);
348
+ updateRoot(message.items, batchedUpdatesWrapper);
344
349
  } else {
345
350
  state.root = load(message.items);
346
351
  }
@@ -371,7 +376,7 @@ function makeStateMachine(state, config, mockedEffects) {
371
376
  }
372
377
  return [root, parentToChildren];
373
378
  }
374
- function updateRoot(items) {
379
+ function updateRoot(items, batchedUpdatesWrapper) {
375
380
  if (!state.root) {
376
381
  return;
377
382
  }
@@ -381,44 +386,46 @@ function makeStateMachine(state, config, mockedEffects) {
381
386
  });
382
387
  const ops = _chunkUV2F4F4Rjs.getTreesDiffOperations.call(void 0, currentItems, new Map(items));
383
388
  const result = apply(ops, false);
384
- notify(result.updates);
389
+ notify(result.updates, batchedUpdatesWrapper);
385
390
  }
386
391
  function load(items) {
387
392
  const [root, parentToChildren] = buildRootAndParentToChildren(items);
388
393
  return _chunkUV2F4F4Rjs.LiveObject._deserialize(root, parentToChildren, pool);
389
394
  }
390
- function _addToRealUndoStack(historyOps) {
395
+ function _addToRealUndoStack(historyOps, batchedUpdatesWrapper) {
391
396
  if (state.undoStack.length >= 50) {
392
397
  state.undoStack.shift();
393
398
  }
394
399
  state.undoStack.push(historyOps);
395
- onHistoryChange();
400
+ onHistoryChange(batchedUpdatesWrapper);
396
401
  }
397
- function addToUndoStack(historyOps) {
402
+ function addToUndoStack(historyOps, batchedUpdatesWrapper) {
398
403
  if (state.pausedHistory !== null) {
399
404
  state.pausedHistory.unshift(...historyOps);
400
405
  } else {
401
- _addToRealUndoStack(historyOps);
406
+ _addToRealUndoStack(historyOps, batchedUpdatesWrapper);
402
407
  }
403
408
  }
404
409
  function notify({
405
410
  storageUpdates = /* @__PURE__ */ new Map(),
406
411
  presence = false,
407
412
  others: otherEvents = []
408
- }) {
409
- if (otherEvents.length > 0) {
410
- const others = state.others.current;
411
- for (const event of otherEvents) {
412
- eventHub.others.notify({ others, event });
413
+ }, batchedUpdatesWrapper) {
414
+ batchedUpdatesWrapper(() => {
415
+ if (otherEvents.length > 0) {
416
+ const others = state.others.current;
417
+ for (const event of otherEvents) {
418
+ eventHub.others.notify({ others, event });
419
+ }
413
420
  }
414
- }
415
- if (presence) {
416
- eventHub.me.notify(state.me.current);
417
- }
418
- if (storageUpdates.size > 0) {
419
- const updates = Array.from(storageUpdates.values());
420
- eventHub.storage.notify(updates);
421
- }
421
+ if (presence) {
422
+ eventHub.me.notify(state.me.current);
423
+ }
424
+ if (storageUpdates.size > 0) {
425
+ const updates = Array.from(storageUpdates.values());
426
+ eventHub.storage.notify(updates);
427
+ }
428
+ });
422
429
  }
423
430
  function getConnectionId() {
424
431
  const conn = state.connection.current;
@@ -610,19 +617,19 @@ function makeStateMachine(state, config, mockedEffects) {
610
617
  return state.connection.current.state;
611
618
  }
612
619
  function connect() {
613
- var _a, _b, _c, _d;
620
+ var _a2, _b, _c, _d;
614
621
  if (state.connection.current.state !== "closed" && state.connection.current.state !== "unavailable") {
615
622
  return null;
616
623
  }
617
624
  const auth = prepareAuthEndpoint(
618
625
  config.authentication,
619
- (_b = (_a = config.polyfills) == null ? void 0 : _a.fetch) != null ? _b : config.fetchPolyfill
626
+ (_b = (_a2 = config.polyfills) == null ? void 0 : _a2.fetch) != null ? _b : config.fetchPolyfill
620
627
  );
621
628
  const createWebSocket = prepareCreateWebSocket(
622
629
  config.liveblocksServer,
623
630
  (_d = (_c = config.polyfills) == null ? void 0 : _c.WebSocket) != null ? _d : config.WebSocketPolyfill
624
631
  );
625
- updateConnection({ state: "authenticating" });
632
+ updateConnection({ state: "authenticating" }, batchUpdates);
626
633
  effects.authenticate(auth, createWebSocket);
627
634
  }
628
635
  function updatePresence(patch, options) {
@@ -652,10 +659,15 @@ function makeStateMachine(state, config, mockedEffects) {
652
659
  state.activeBatch.updates.presence = true;
653
660
  } else {
654
661
  tryFlushing();
655
- if (options == null ? void 0 : options.addToHistory) {
656
- addToUndoStack([{ type: "presence", data: oldValues }]);
657
- }
658
- notify({ presence: true });
662
+ batchUpdates(() => {
663
+ if (options == null ? void 0 : options.addToHistory) {
664
+ addToUndoStack(
665
+ [{ type: "presence", data: oldValues }],
666
+ doNotBatchUpdates
667
+ );
668
+ }
669
+ notify({ presence: true }, doNotBatchUpdates);
670
+ });
659
671
  }
660
672
  }
661
673
  function authenticationSuccess(token, socket) {
@@ -663,12 +675,15 @@ function makeStateMachine(state, config, mockedEffects) {
663
675
  socket.addEventListener("open", onOpen);
664
676
  socket.addEventListener("close", onClose);
665
677
  socket.addEventListener("error", onError);
666
- updateConnection({
667
- state: "connecting",
668
- id: token.actor,
669
- userInfo: token.info,
670
- userId: token.id
671
- });
678
+ updateConnection(
679
+ {
680
+ state: "connecting",
681
+ id: token.actor,
682
+ userInfo: token.info,
683
+ userId: token.id
684
+ },
685
+ batchUpdates
686
+ );
672
687
  state.idFactory = makeIdFactory(token.actor);
673
688
  state.socket = socket;
674
689
  }
@@ -677,7 +692,7 @@ function makeStateMachine(state, config, mockedEffects) {
677
692
  console.error("Call to authentication endpoint failed", error);
678
693
  }
679
694
  state.token = null;
680
- updateConnection({ state: "unavailable" });
695
+ updateConnection({ state: "unavailable" }, batchUpdates);
681
696
  state.numberOfRetry++;
682
697
  state.timeoutHandles.reconnect = effects.scheduleReconnect(getRetryDelay());
683
698
  }
@@ -731,8 +746,10 @@ function makeStateMachine(state, config, mockedEffects) {
731
746
  reconnect();
732
747
  }
733
748
  }
734
- function onHistoryChange() {
735
- eventHub.history.notify({ canUndo: canUndo(), canRedo: canRedo() });
749
+ function onHistoryChange(batchedUpdatesWrapper) {
750
+ batchedUpdatesWrapper(() => {
751
+ eventHub.history.notify({ canUndo: canUndo(), canRedo: canRedo() });
752
+ });
736
753
  }
737
754
  function onUserJoinedMessage(message) {
738
755
  state.others.setConnection(message.actor, message.id, message.info);
@@ -774,64 +791,66 @@ function makeStateMachine(state, config, mockedEffects) {
774
791
  storageUpdates: /* @__PURE__ */ new Map(),
775
792
  others: []
776
793
  };
777
- for (const message of messages) {
778
- switch (message.type) {
779
- case 101 /* USER_JOINED */: {
780
- const userJoinedUpdate = onUserJoinedMessage(message);
781
- if (userJoinedUpdate) {
782
- updates.others.push(userJoinedUpdate);
794
+ batchUpdates(() => {
795
+ for (const message of messages) {
796
+ switch (message.type) {
797
+ case 101 /* USER_JOINED */: {
798
+ const userJoinedUpdate = onUserJoinedMessage(message);
799
+ if (userJoinedUpdate) {
800
+ updates.others.push(userJoinedUpdate);
801
+ }
802
+ break;
783
803
  }
784
- break;
785
- }
786
- case 100 /* UPDATE_PRESENCE */: {
787
- const othersPresenceUpdate = onUpdatePresenceMessage(message);
788
- if (othersPresenceUpdate) {
789
- updates.others.push(othersPresenceUpdate);
804
+ case 100 /* UPDATE_PRESENCE */: {
805
+ const othersPresenceUpdate = onUpdatePresenceMessage(message);
806
+ if (othersPresenceUpdate) {
807
+ updates.others.push(othersPresenceUpdate);
808
+ }
809
+ break;
790
810
  }
791
- break;
792
- }
793
- case 103 /* BROADCASTED_EVENT */: {
794
- eventHub.customEvent.notify({
795
- connectionId: message.actor,
796
- event: message.event
797
- });
798
- break;
799
- }
800
- case 102 /* USER_LEFT */: {
801
- const event2 = onUserLeftMessage(message);
802
- if (event2) {
803
- updates.others.push(event2);
811
+ case 103 /* BROADCASTED_EVENT */: {
812
+ eventHub.customEvent.notify({
813
+ connectionId: message.actor,
814
+ event: message.event
815
+ });
816
+ break;
817
+ }
818
+ case 102 /* USER_LEFT */: {
819
+ const event2 = onUserLeftMessage(message);
820
+ if (event2) {
821
+ updates.others.push(event2);
822
+ }
823
+ break;
824
+ }
825
+ case 104 /* ROOM_STATE */: {
826
+ updates.others.push(onRoomStateMessage(message));
827
+ break;
828
+ }
829
+ case 200 /* INITIAL_STORAGE_STATE */: {
830
+ const offlineOps = new Map(state.offlineOperations);
831
+ createOrUpdateRootFromMessage(message, doNotBatchUpdates);
832
+ applyAndSendOfflineOps(offlineOps, doNotBatchUpdates);
833
+ _getInitialStateResolver == null ? void 0 : _getInitialStateResolver();
834
+ eventHub.storageDidLoad.notify();
835
+ break;
836
+ }
837
+ case 201 /* UPDATE_STORAGE */: {
838
+ const applyResult = apply(message.ops, false);
839
+ applyResult.updates.storageUpdates.forEach((value, key) => {
840
+ updates.storageUpdates.set(
841
+ key,
842
+ _chunkUV2F4F4Rjs.mergeStorageUpdates.call(void 0,
843
+ updates.storageUpdates.get(key),
844
+ value
845
+ )
846
+ );
847
+ });
848
+ break;
804
849
  }
805
- break;
806
- }
807
- case 104 /* ROOM_STATE */: {
808
- updates.others.push(onRoomStateMessage(message));
809
- break;
810
- }
811
- case 200 /* INITIAL_STORAGE_STATE */: {
812
- const offlineOps = new Map(state.offlineOperations);
813
- createOrUpdateRootFromMessage(message);
814
- applyAndSendOfflineOps(offlineOps);
815
- _getInitialStateResolver == null ? void 0 : _getInitialStateResolver();
816
- eventHub.storageDidLoad.notify();
817
- break;
818
- }
819
- case 201 /* UPDATE_STORAGE */: {
820
- const applyResult = apply(message.ops, false);
821
- applyResult.updates.storageUpdates.forEach((value, key) => {
822
- updates.storageUpdates.set(
823
- key,
824
- _chunkUV2F4F4Rjs.mergeStorageUpdates.call(void 0,
825
- updates.storageUpdates.get(key),
826
- value
827
- )
828
- );
829
- });
830
- break;
831
850
  }
832
851
  }
833
- }
834
- notify(updates);
852
+ notify(updates, doNotBatchUpdates);
853
+ });
835
854
  }
836
855
  function onClose(event) {
837
856
  state.socket = null;
@@ -842,37 +861,41 @@ function makeStateMachine(state, config, mockedEffects) {
842
861
  }
843
862
  clearTimeout(state.timeoutHandles.reconnect);
844
863
  state.others.clearOthers();
845
- notify({ others: [{ type: "reset" }] });
846
- if (event.code >= 4e3 && event.code <= 4100) {
847
- updateConnection({ state: "failed" });
848
- const error = new LiveblocksError(event.reason, event.code);
849
- eventHub.error.notify(error);
850
- const delay = getRetryDelay(true);
851
- state.numberOfRetry++;
852
- if (process.env.NODE_ENV !== "production") {
853
- console.error(
854
- `Connection to Liveblocks websocket server closed. Reason: ${error.message} (code: ${error.code}). Retrying in ${delay}ms.`
855
- );
856
- }
857
- updateConnection({ state: "unavailable" });
858
- state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
859
- } else if (event.code === 4999 /* CLOSE_WITHOUT_RETRY */) {
860
- updateConnection({ state: "closed" });
861
- } else {
862
- const delay = getRetryDelay();
863
- state.numberOfRetry++;
864
- if (process.env.NODE_ENV !== "production") {
865
- console.warn(
866
- `Connection to Liveblocks websocket server closed (code: ${event.code}). Retrying in ${delay}ms.`
867
- );
864
+ batchUpdates(() => {
865
+ notify({ others: [{ type: "reset" }] }, doNotBatchUpdates);
866
+ if (event.code >= 4e3 && event.code <= 4100) {
867
+ updateConnection({ state: "failed" }, doNotBatchUpdates);
868
+ const error = new LiveblocksError(event.reason, event.code);
869
+ eventHub.error.notify(error);
870
+ const delay = getRetryDelay(true);
871
+ state.numberOfRetry++;
872
+ if (process.env.NODE_ENV !== "production") {
873
+ console.error(
874
+ `Connection to Liveblocks websocket server closed. Reason: ${error.message} (code: ${error.code}). Retrying in ${delay}ms.`
875
+ );
876
+ }
877
+ updateConnection({ state: "unavailable" }, doNotBatchUpdates);
878
+ state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
879
+ } else if (event.code === 4999 /* CLOSE_WITHOUT_RETRY */) {
880
+ updateConnection({ state: "closed" }, doNotBatchUpdates);
881
+ } else {
882
+ const delay = getRetryDelay();
883
+ state.numberOfRetry++;
884
+ if (process.env.NODE_ENV !== "production") {
885
+ console.warn(
886
+ `Connection to Liveblocks websocket server closed (code: ${event.code}). Retrying in ${delay}ms.`
887
+ );
888
+ }
889
+ updateConnection({ state: "unavailable" }, doNotBatchUpdates);
890
+ state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
868
891
  }
869
- updateConnection({ state: "unavailable" });
870
- state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
871
- }
892
+ });
872
893
  }
873
- function updateConnection(connection) {
894
+ function updateConnection(connection, batchedUpdatesWrapper) {
874
895
  state.connection.set(connection);
875
- eventHub.connection.notify(connection.state);
896
+ batchedUpdatesWrapper(() => {
897
+ eventHub.connection.notify(connection.state);
898
+ });
876
899
  }
877
900
  function getRetryDelay(slow = false) {
878
901
  if (slow) {
@@ -886,7 +909,10 @@ function makeStateMachine(state, config, mockedEffects) {
886
909
  clearInterval(state.intervalHandles.heartbeat);
887
910
  state.intervalHandles.heartbeat = effects.startHeartbeatInterval();
888
911
  if (state.connection.current.state === "connecting") {
889
- updateConnection(_chunkUV2F4F4Rjs.__spreadProps.call(void 0, _chunkUV2F4F4Rjs.__spreadValues.call(void 0, {}, state.connection.current), { state: "open" }));
912
+ updateConnection(
913
+ _chunkUV2F4F4Rjs.__spreadProps.call(void 0, _chunkUV2F4F4Rjs.__spreadValues.call(void 0, {}, state.connection.current), { state: "open" }),
914
+ batchUpdates
915
+ );
890
916
  state.numberOfRetry = 0;
891
917
  if (state.lastConnectionId !== void 0) {
892
918
  state.buffer.me = {
@@ -926,7 +952,7 @@ function makeStateMachine(state, config, mockedEffects) {
926
952
  state.socket.close();
927
953
  state.socket = null;
928
954
  }
929
- updateConnection({ state: "unavailable" });
955
+ updateConnection({ state: "unavailable" }, batchUpdates);
930
956
  clearTimeout(state.timeoutHandles.pongTimeout);
931
957
  if (state.timeoutHandles.flush) {
932
958
  clearTimeout(state.timeoutHandles.flush);
@@ -935,7 +961,7 @@ function makeStateMachine(state, config, mockedEffects) {
935
961
  clearInterval(state.intervalHandles.heartbeat);
936
962
  connect();
937
963
  }
938
- function applyAndSendOfflineOps(offlineOps) {
964
+ function applyAndSendOfflineOps(offlineOps, batchedUpdatesWrapper) {
939
965
  if (offlineOps.size === 0) {
940
966
  return;
941
967
  }
@@ -946,7 +972,7 @@ function makeStateMachine(state, config, mockedEffects) {
946
972
  type: 201 /* UPDATE_STORAGE */,
947
973
  ops
948
974
  });
949
- notify(result.updates);
975
+ notify(result.updates, batchedUpdatesWrapper);
950
976
  effects.send(messages);
951
977
  }
952
978
  function tryFlushing() {
@@ -1017,16 +1043,18 @@ function makeStateMachine(state, config, mockedEffects) {
1017
1043
  state.socket.close();
1018
1044
  state.socket = null;
1019
1045
  }
1020
- updateConnection({ state: "closed" });
1021
- if (state.timeoutHandles.flush) {
1022
- clearTimeout(state.timeoutHandles.flush);
1023
- }
1024
- clearTimeout(state.timeoutHandles.reconnect);
1025
- clearTimeout(state.timeoutHandles.pongTimeout);
1026
- clearInterval(state.intervalHandles.heartbeat);
1027
- state.others.clearOthers();
1028
- notify({ others: [{ type: "reset" }] });
1029
- Object.values(eventHub).forEach((eventSource) => eventSource.clear());
1046
+ batchUpdates(() => {
1047
+ updateConnection({ state: "closed" }, doNotBatchUpdates);
1048
+ if (state.timeoutHandles.flush) {
1049
+ clearTimeout(state.timeoutHandles.flush);
1050
+ }
1051
+ clearTimeout(state.timeoutHandles.reconnect);
1052
+ clearTimeout(state.timeoutHandles.pongTimeout);
1053
+ clearInterval(state.intervalHandles.heartbeat);
1054
+ state.others.clearOthers();
1055
+ notify({ others: [{ type: "reset" }] }, doNotBatchUpdates);
1056
+ Object.values(eventHub).forEach((eventSource) => eventSource.clear());
1057
+ });
1030
1058
  }
1031
1059
  function getPresence() {
1032
1060
  return state.me.current;
@@ -1094,9 +1122,11 @@ function makeStateMachine(state, config, mockedEffects) {
1094
1122
  }
1095
1123
  state.pausedHistory = null;
1096
1124
  const result = apply(historyOps, true);
1097
- notify(result.updates);
1098
- state.redoStack.push(result.reverse);
1099
- onHistoryChange();
1125
+ batchUpdates(() => {
1126
+ notify(result.updates, doNotBatchUpdates);
1127
+ state.redoStack.push(result.reverse);
1128
+ onHistoryChange(doNotBatchUpdates);
1129
+ });
1100
1130
  for (const op of historyOps) {
1101
1131
  if (op.type !== "presence") {
1102
1132
  state.buffer.storageOperations.push(op);
@@ -1117,9 +1147,11 @@ function makeStateMachine(state, config, mockedEffects) {
1117
1147
  }
1118
1148
  state.pausedHistory = null;
1119
1149
  const result = apply(historyOps, true);
1120
- notify(result.updates);
1121
- state.undoStack.push(result.reverse);
1122
- onHistoryChange();
1150
+ batchUpdates(() => {
1151
+ notify(result.updates, doNotBatchUpdates);
1152
+ state.undoStack.push(result.reverse);
1153
+ onHistoryChange(doNotBatchUpdates);
1154
+ });
1123
1155
  for (const op of historyOps) {
1124
1156
  if (op.type !== "presence") {
1125
1157
  state.buffer.storageOperations.push(op);
@@ -1134,32 +1166,36 @@ function makeStateMachine(state, config, mockedEffects) {
1134
1166
  if (state.activeBatch) {
1135
1167
  return callback();
1136
1168
  }
1137
- state.activeBatch = {
1138
- ops: [],
1139
- updates: {
1140
- storageUpdates: /* @__PURE__ */ new Map(),
1141
- presence: false,
1142
- others: []
1143
- },
1144
- reverseOps: []
1145
- };
1146
- try {
1147
- return callback();
1148
- } finally {
1149
- const currentBatch = state.activeBatch;
1150
- state.activeBatch = null;
1151
- if (currentBatch.reverseOps.length > 0) {
1152
- addToUndoStack(currentBatch.reverseOps);
1153
- }
1154
- if (currentBatch.ops.length > 0) {
1155
- state.redoStack = [];
1156
- }
1157
- if (currentBatch.ops.length > 0) {
1158
- dispatchOps(currentBatch.ops);
1169
+ let rv = void 0;
1170
+ batchUpdates(() => {
1171
+ state.activeBatch = {
1172
+ ops: [],
1173
+ updates: {
1174
+ storageUpdates: /* @__PURE__ */ new Map(),
1175
+ presence: false,
1176
+ others: []
1177
+ },
1178
+ reverseOps: []
1179
+ };
1180
+ try {
1181
+ rv = callback();
1182
+ } finally {
1183
+ const currentBatch = state.activeBatch;
1184
+ state.activeBatch = null;
1185
+ if (currentBatch.reverseOps.length > 0) {
1186
+ addToUndoStack(currentBatch.reverseOps, doNotBatchUpdates);
1187
+ }
1188
+ if (currentBatch.ops.length > 0) {
1189
+ state.redoStack = [];
1190
+ }
1191
+ if (currentBatch.ops.length > 0) {
1192
+ dispatchOps(currentBatch.ops);
1193
+ }
1194
+ notify(currentBatch.updates, doNotBatchUpdates);
1195
+ tryFlushing();
1159
1196
  }
1160
- notify(currentBatch.updates);
1161
- tryFlushing();
1162
- }
1197
+ });
1198
+ return rv;
1163
1199
  }
1164
1200
  function pauseHistory() {
1165
1201
  state.pausedHistory = [];
@@ -1168,7 +1204,7 @@ function makeStateMachine(state, config, mockedEffects) {
1168
1204
  const historyOps = state.pausedHistory;
1169
1205
  state.pausedHistory = null;
1170
1206
  if (historyOps !== null && historyOps.length > 0) {
1171
- _addToRealUndoStack(historyOps);
1207
+ _addToRealUndoStack(historyOps, batchUpdates);
1172
1208
  }
1173
1209
  }
1174
1210
  function simulateSocketClose() {
@@ -1322,7 +1358,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
1322
1358
  const ws = WebSocketPolyfill || WebSocket;
1323
1359
  return (token) => {
1324
1360
  return new ws(
1325
- `${liveblocksServer}/?token=${token}&version=${true ? "0.18.2" : "dev"}`
1361
+ `${liveblocksServer}/?token=${token}&version=${true ? "0.18.3" : "dev"}`
1326
1362
  );
1327
1363
  };
1328
1364
  }
@@ -1430,6 +1466,7 @@ function createClient(options) {
1430
1466
  polyfills: clientOptions.polyfills,
1431
1467
  WebSocketPolyfill: clientOptions.WebSocketPolyfill,
1432
1468
  fetchPolyfill: clientOptions.fetchPolyfill,
1469
+ unstable_batchedUpdates: options2 == null ? void 0 : options2.unstable_batchedUpdates,
1433
1470
  liveblocksServer: (clientOptions == null ? void 0 : clientOptions.liveblocksServer) || "wss://api.liveblocks.io/v6",
1434
1471
  authentication: prepareAuthentication(clientOptions, roomId)
1435
1472
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/client",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "description": "A client that lets you interact with Liveblocks servers.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",