@liveblocks/react 1.12.0-test1 → 1.12.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 +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
5
5
|
|
|
6
6
|
// src/version.ts
|
|
7
7
|
var PKG_NAME = "@liveblocks/react";
|
|
8
|
-
var PKG_VERSION = "1.12.0
|
|
8
|
+
var PKG_VERSION = "1.12.0";
|
|
9
9
|
var PKG_FORMAT = "esm";
|
|
10
10
|
|
|
11
11
|
// src/ClientSideSuspense.tsx
|
|
@@ -194,7 +194,14 @@ function selectedThreads(roomId, state, options) {
|
|
|
194
194
|
if (!query)
|
|
195
195
|
return true;
|
|
196
196
|
for (const key in query.metadata) {
|
|
197
|
-
|
|
197
|
+
const metadataValue = thread.metadata[key];
|
|
198
|
+
const filterValue = query.metadata[key];
|
|
199
|
+
if (assertFilterIsStartsWithOperator(filterValue) && assertMetadataValueIsString(metadataValue)) {
|
|
200
|
+
if (metadataValue.startsWith(filterValue.startsWith)) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (metadataValue !== filterValue) {
|
|
198
205
|
return false;
|
|
199
206
|
}
|
|
200
207
|
}
|
|
@@ -202,6 +209,16 @@ function selectedThreads(roomId, state, options) {
|
|
|
202
209
|
});
|
|
203
210
|
return threads.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
204
211
|
}
|
|
212
|
+
var assertFilterIsStartsWithOperator = (filter) => {
|
|
213
|
+
if (typeof filter === "object" && typeof filter.startsWith === "string") {
|
|
214
|
+
return true;
|
|
215
|
+
} else {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
var assertMetadataValueIsString = (value) => {
|
|
220
|
+
return typeof value === "string";
|
|
221
|
+
};
|
|
205
222
|
|
|
206
223
|
// src/lib/use-initial.ts
|
|
207
224
|
import { useState as useState2 } from "react";
|
|
@@ -2270,18 +2287,29 @@ function createLiveblocksContext(client) {
|
|
|
2270
2287
|
);
|
|
2271
2288
|
}, []);
|
|
2272
2289
|
}
|
|
2273
|
-
function
|
|
2290
|
+
function useInboxNotificationThread(inboxNotificationId) {
|
|
2274
2291
|
const selector = useCallback3(
|
|
2275
2292
|
(state) => {
|
|
2276
|
-
const
|
|
2293
|
+
const inboxNotification = state.inboxNotifications[inboxNotificationId];
|
|
2294
|
+
if (inboxNotification === void 0) {
|
|
2295
|
+
throw new Error(
|
|
2296
|
+
`Inbox notification with ID "${inboxNotificationId}" not found`
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
if (inboxNotification.kind !== "thread") {
|
|
2300
|
+
throw new Error(
|
|
2301
|
+
`Inbox notification with ID "${inboxNotificationId}" is not of kind "thread"`
|
|
2302
|
+
);
|
|
2303
|
+
}
|
|
2304
|
+
const thread = state.threads[inboxNotification.threadId];
|
|
2277
2305
|
if (thread === void 0) {
|
|
2278
2306
|
throw new Error(
|
|
2279
|
-
`
|
|
2307
|
+
`Thread with ID "${inboxNotification.threadId}" not found, this inbox notification might not be of kind "thread"`
|
|
2280
2308
|
);
|
|
2281
2309
|
}
|
|
2282
2310
|
return thread;
|
|
2283
2311
|
},
|
|
2284
|
-
[
|
|
2312
|
+
[inboxNotificationId]
|
|
2285
2313
|
);
|
|
2286
2314
|
return useSyncExternalStoreWithSelector2(
|
|
2287
2315
|
store.subscribe,
|
|
@@ -2304,6 +2332,7 @@ function createLiveblocksContext(client) {
|
|
|
2304
2332
|
useUnreadInboxNotificationsCount,
|
|
2305
2333
|
useMarkInboxNotificationAsRead,
|
|
2306
2334
|
useMarkAllInboxNotificationsAsRead,
|
|
2335
|
+
useInboxNotificationThread,
|
|
2307
2336
|
...shared,
|
|
2308
2337
|
suspense: {
|
|
2309
2338
|
LiveblocksProvider,
|
|
@@ -2311,10 +2340,10 @@ function createLiveblocksContext(client) {
|
|
|
2311
2340
|
useUnreadInboxNotificationsCount: useUnreadInboxNotificationsCountSuspense,
|
|
2312
2341
|
useMarkInboxNotificationAsRead,
|
|
2313
2342
|
useMarkAllInboxNotificationsAsRead,
|
|
2343
|
+
useInboxNotificationThread,
|
|
2314
2344
|
...shared.suspense
|
|
2315
2345
|
},
|
|
2316
2346
|
[kInternal3]: {
|
|
2317
|
-
useThreadFromCache,
|
|
2318
2347
|
useCurrentUserId
|
|
2319
2348
|
}
|
|
2320
2349
|
};
|