@liveblocks/core 2.12.2 → 2.13.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/dist/index.d.mts CHANGED
@@ -2895,10 +2895,12 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
2895
2895
  resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
2896
2896
  /**
2897
2897
  * A function that returns user info from user IDs.
2898
+ * You should return a list of user objects of the same size, in the same order.
2898
2899
  */
2899
2900
  resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
2900
2901
  /**
2901
2902
  * A function that returns room info from room IDs.
2903
+ * You should return a list of room info objects of the same size, in the same order.
2902
2904
  */
2903
2905
  resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
2904
2906
  /**
@@ -3011,6 +3013,7 @@ declare type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3011
3013
  separator?: string;
3012
3014
  /**
3013
3015
  * A function that returns user info from user IDs.
3016
+ * You should return a list of user objects of the same size, in the same order.
3014
3017
  */
3015
3018
  resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3016
3019
  };
package/dist/index.d.ts CHANGED
@@ -2895,10 +2895,12 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
2895
2895
  resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
2896
2896
  /**
2897
2897
  * A function that returns user info from user IDs.
2898
+ * You should return a list of user objects of the same size, in the same order.
2898
2899
  */
2899
2900
  resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
2900
2901
  /**
2901
2902
  * A function that returns room info from room IDs.
2903
+ * You should return a list of room info objects of the same size, in the same order.
2902
2904
  */
2903
2905
  resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
2904
2906
  /**
@@ -3011,6 +3013,7 @@ declare type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3011
3013
  separator?: string;
3012
3014
  /**
3013
3015
  * A function that returns user info from user IDs.
3016
+ * You should return a list of user objects of the same size, in the same order.
3014
3017
  */
3015
3018
  resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3016
3019
  };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.12.2";
9
+ var PKG_VERSION = "2.13.0";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -303,7 +303,6 @@ function Promise_withResolvers() {
303
303
 
304
304
  // src/lib/EventSource.ts
305
305
  function makeEventSource() {
306
- const _onetimeObservers = /* @__PURE__ */ new Set();
307
306
  const _observers = /* @__PURE__ */ new Set();
308
307
  let _buffer = null;
309
308
  function pause() {
@@ -323,8 +322,11 @@ function makeEventSource() {
323
322
  return () => _observers.delete(callback);
324
323
  }
325
324
  function subscribeOnce(callback) {
326
- _onetimeObservers.add(callback);
327
- return () => _onetimeObservers.delete(callback);
325
+ const unsub = subscribe((event) => {
326
+ unsub();
327
+ return callback(event);
328
+ });
329
+ return unsub;
328
330
  }
329
331
  async function waitUntil(predicate) {
330
332
  let unsub;
@@ -344,16 +346,13 @@ function makeEventSource() {
344
346
  }
345
347
  }
346
348
  function notify(event) {
347
- _onetimeObservers.forEach((callback) => callback(event));
348
- _onetimeObservers.clear();
349
349
  _observers.forEach((callback) => callback(event));
350
350
  }
351
351
  function _forceClear() {
352
- _onetimeObservers.clear();
353
352
  _observers.clear();
354
353
  }
355
354
  function count() {
356
- return _onetimeObservers.size + _observers.size;
355
+ return _observers.size;
357
356
  }
358
357
  return {
359
358
  // Private/internal control over event emission