@liveblocks/react 3.13.0-ack1 → 3.13.0-metadata1
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/_private.cjs +7 -7
- package/dist/_private.d.cts +2 -2
- package/dist/_private.d.ts +2 -2
- package/dist/_private.js +1 -1
- package/dist/{chunk-U3DNN4V2.cjs → chunk-43FP2UXY.cjs} +2 -2
- package/dist/chunk-43FP2UXY.cjs.map +1 -0
- package/dist/{chunk-ONFO7EAV.js → chunk-5WSMZNJK.js} +2 -2
- package/dist/{chunk-ZDBJCDFH.js → chunk-LGJ7R5KY.js} +171 -16
- package/dist/chunk-LGJ7R5KY.js.map +1 -0
- package/dist/{chunk-WH55MUS4.cjs → chunk-UTYX6TS4.cjs} +170 -15
- package/dist/chunk-UTYX6TS4.cjs.map +1 -0
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{room-Bff8edwh.d.cts → room-N2gjE_Co.d.cts} +143 -107
- package/dist/{room-Bff8edwh.d.ts → room-N2gjE_Co.d.ts} +143 -107
- package/dist/suspense.cjs +6 -4
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +8 -6
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-U3DNN4V2.cjs.map +0 -1
- package/dist/chunk-WH55MUS4.cjs.map +0 -1
- package/dist/chunk-ZDBJCDFH.js.map +0 -1
- /package/dist/{chunk-ONFO7EAV.js.map → chunk-5WSMZNJK.js.map} +0 -0
package/dist/_private.cjs
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkUTYX6TS4cjs = require('./chunk-UTYX6TS4.cjs');
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
var _react = require('react');
|
|
@@ -50,7 +50,7 @@ function selectorFor_useGroup(state) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function useGroup(groupId) {
|
|
53
|
-
const client =
|
|
53
|
+
const client = _chunkUTYX6TS4cjs.useClient.call(void 0, );
|
|
54
54
|
const store = client[_core.kInternal].httpClient.groupsStore;
|
|
55
55
|
const getGroupState = _react.useCallback.call(void 0,
|
|
56
56
|
() => store.getItemState(groupId),
|
|
@@ -59,7 +59,7 @@ function useGroup(groupId) {
|
|
|
59
59
|
_react.useEffect.call(void 0, () => {
|
|
60
60
|
void store.enqueue(groupId);
|
|
61
61
|
}, [store, groupId]);
|
|
62
|
-
return
|
|
62
|
+
return _chunkUTYX6TS4cjs.useSyncExternalStoreWithSelector.call(void 0,
|
|
63
63
|
store.subscribe,
|
|
64
64
|
getGroupState,
|
|
65
65
|
getGroupState,
|
|
@@ -80,8 +80,8 @@ function normalizeMentionSuggestions(suggestions) {
|
|
|
80
80
|
function useMentionSuggestions(roomId, search) {
|
|
81
81
|
const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
|
|
82
82
|
const lastInvokedAt = _react.useRef.call(void 0, );
|
|
83
|
-
const resolveMentionSuggestions =
|
|
84
|
-
const mentionSuggestionsCache =
|
|
83
|
+
const resolveMentionSuggestions = _chunkUTYX6TS4cjs.useResolveMentionSuggestions.call(void 0, );
|
|
84
|
+
const mentionSuggestionsCache = _chunkUTYX6TS4cjs.useMentionSuggestionsCache.call(void 0, );
|
|
85
85
|
_react.useEffect.call(void 0, () => {
|
|
86
86
|
if (search === void 0 || !resolveMentionSuggestions) {
|
|
87
87
|
return;
|
|
@@ -136,7 +136,7 @@ function useMentionSuggestions(roomId, search) {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
function useSyncSource() {
|
|
139
|
-
const client =
|
|
139
|
+
const client = _chunkUTYX6TS4cjs.useClient.call(void 0, );
|
|
140
140
|
const createSyncSource = client[_core.kInternal].createSyncSource;
|
|
141
141
|
const [syncSource, setSyncSource] = _react.useState.call(void 0, );
|
|
142
142
|
_react.useEffect.call(void 0, () => {
|
|
@@ -176,5 +176,5 @@ function useSyncSource() {
|
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
exports.getUmbrellaStoreForClient =
|
|
179
|
+
exports.getUmbrellaStoreForClient = _chunkUTYX6TS4cjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkUTYX6TS4cjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkUTYX6TS4cjs.useClientOrNull; exports.useCreateRoomComment = _chunkUTYX6TS4cjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkUTYX6TS4cjs.useCreateRoomThread; exports.useCreateTextMention = _chunkUTYX6TS4cjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkUTYX6TS4cjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkUTYX6TS4cjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkUTYX6TS4cjs.useDeleteTextMention; exports.useEditRoomComment = _chunkUTYX6TS4cjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkUTYX6TS4cjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunkUTYX6TS4cjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkUTYX6TS4cjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkUTYX6TS4cjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkUTYX6TS4cjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkUTYX6TS4cjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkUTYX6TS4cjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkUTYX6TS4cjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkUTYX6TS4cjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkUTYX6TS4cjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunkUTYX6TS4cjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunkUTYX6TS4cjs.useRoomThreadSubscription; exports.useSignal = _chunkUTYX6TS4cjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkUTYX6TS4cjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkUTYX6TS4cjs.useYjsProvider;
|
|
180
180
|
//# sourceMappingURL=_private.cjs.map
|
package/dist/_private.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-N2gjE_Co.cjs';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-N2gjE_Co.cjs';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GroupAsyncResult } from './room-
|
|
2
|
-
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-
|
|
1
|
+
import { G as GroupAsyncResult } from './room-N2gjE_Co.js';
|
|
2
|
+
export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useRoomThreadSubscription, v as useYjsProvider } from './room-N2gjE_Co.js';
|
|
3
3
|
import { MutableRefObject, useEffect } from 'react';
|
|
4
4
|
import { MentionData, ISignal, SyncSource } from '@liveblocks/core';
|
|
5
5
|
import '@liveblocks/client';
|
package/dist/_private.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
useSignal,
|
|
26
26
|
useSyncExternalStoreWithSelector,
|
|
27
27
|
useYjsProvider
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-LGJ7R5KY.js";
|
|
29
29
|
|
|
30
30
|
// src/lib/use-layout-effect.ts
|
|
31
31
|
import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/version.ts
|
|
2
2
|
var PKG_NAME = "@liveblocks/react";
|
|
3
|
-
var PKG_VERSION = "3.13.0-
|
|
3
|
+
var PKG_VERSION = "3.13.0-metadata1";
|
|
4
4
|
var PKG_FORMAT = "cjs";
|
|
5
5
|
|
|
6
6
|
// src/ClientSideSuspense.tsx
|
|
@@ -20,4 +20,4 @@ function ClientSideSuspense(props) {
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
exports.PKG_NAME = PKG_NAME; exports.PKG_VERSION = PKG_VERSION; exports.PKG_FORMAT = PKG_FORMAT; exports.ClientSideSuspense = ClientSideSuspense;
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-43FP2UXY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-43FP2UXY.cjs","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,kBAAA;AACvD,IAAM,WAAA,EAAgD,KAAA;ADD7D;AACA;AEJA,8BAA8C;AAkC1C,+CAAA;AAVG,SAAS,kBAAA,CAAmB,KAAA,EAAc;AAC/C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,EAAA,EAAI,6BAAA,KAAc,CAAA;AAE5C,EAAA,8BAAA,CAAU,EAAA,GAAM;AAGd,IAAA,UAAA,CAAW,IAAI,CAAA;AAAA,EACjB,CAAA,EAAG,CAAC,CAAC,CAAA;AAEL,EAAA,uBACE,6BAAA,eAAC,EAAA,EAAS,QAAA,EAAU,KAAA,CAAM,QAAA,EACvB,QAAA,EAAA,QAAA,EACG,OAAO,KAAA,CAAM,SAAA,IAAa,WAAA,EACxB,KAAA,CAAM,QAAA,CAAS,EAAA,EACf,KAAA,CAAM,SAAA,EACR,KAAA,CAAM,SAAA,CACZ,CAAA;AAEJ;AF5BA;AACA;AACE;AACA;AACA;AACA;AACF,iJAAC","file":"/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-43FP2UXY.cjs","sourcesContent":[null,"declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n","import type { ReactNode } from \"react\";\nimport { Suspense, useEffect, useState } from \"react\";\n\ntype Props = {\n fallback: ReactNode;\n children: (() => ReactNode | undefined) | ReactNode | undefined;\n};\n\n/**\n * Almost like a normal <Suspense> component, except that for server-side\n * renders, the fallback will be used.\n *\n * The child props will have to be provided in a function, i.e. change:\n *\n * <Suspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </Suspense>\n *\n * To:\n *\n * <ClientSideSuspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </ClientSideSuspense>\n *\n */\nexport function ClientSideSuspense(props: Props) {\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n // Effects are never executed on the server side. The point of this is to\n // delay the flipping of this boolean until after hydration has happened.\n setMounted(true);\n }, []);\n\n return (\n <Suspense fallback={props.fallback}>\n {mounted\n ? typeof props.children === \"function\"\n ? props.children()\n : props.children\n : props.fallback}\n </Suspense>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
2
|
var PKG_NAME = "@liveblocks/react";
|
|
3
|
-
var PKG_VERSION = "3.13.0-
|
|
3
|
+
var PKG_VERSION = "3.13.0-metadata1";
|
|
4
4
|
var PKG_FORMAT = "esm";
|
|
5
5
|
|
|
6
6
|
// src/ClientSideSuspense.tsx
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
PKG_FORMAT,
|
|
21
21
|
ClientSideSuspense
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-5WSMZNJK.js.map
|
|
@@ -330,7 +330,7 @@ import {
|
|
|
330
330
|
isStartsWithOperator
|
|
331
331
|
} from "@liveblocks/core";
|
|
332
332
|
function makeThreadsFilter(query, subscriptions) {
|
|
333
|
-
return (thread) => matchesThreadsQuery(thread, query, subscriptions) &&
|
|
333
|
+
return (thread) => matchesThreadsQuery(thread, query, subscriptions) && matchesThreadMetadata(thread, query);
|
|
334
334
|
}
|
|
335
335
|
function matchesThreadsQuery(thread, q, subscriptions) {
|
|
336
336
|
let subscription = void 0;
|
|
@@ -339,7 +339,7 @@ function matchesThreadsQuery(thread, q, subscriptions) {
|
|
|
339
339
|
}
|
|
340
340
|
return (q.resolved === void 0 || thread.resolved === q.resolved) && (q.subscribed === void 0 || q.subscribed === true && subscription !== void 0 || q.subscribed === false && subscription === void 0);
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function matchesThreadMetadata(thread, q) {
|
|
343
343
|
const metadata = thread.metadata;
|
|
344
344
|
return q.metadata === void 0 || Object.entries(q.metadata).every(
|
|
345
345
|
([key, op]) => (
|
|
@@ -1519,6 +1519,26 @@ var UmbrellaStore = class {
|
|
|
1519
1519
|
(thread) => applyUpsertComment(thread, editedComment)
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
|
+
editCommentMetadata(threadId, commentId, optimisticId, updatedMetadata, updatedAt) {
|
|
1523
|
+
return this.#updateThread(
|
|
1524
|
+
threadId,
|
|
1525
|
+
optimisticId,
|
|
1526
|
+
(thread) => {
|
|
1527
|
+
const comment = thread.comments.find((c) => c.id === commentId);
|
|
1528
|
+
if (comment === void 0) {
|
|
1529
|
+
return thread;
|
|
1530
|
+
}
|
|
1531
|
+
return {
|
|
1532
|
+
...thread,
|
|
1533
|
+
updatedAt,
|
|
1534
|
+
comments: thread.comments.map(
|
|
1535
|
+
(c) => c.id === commentId ? { ...c, metadata: updatedMetadata } : c
|
|
1536
|
+
)
|
|
1537
|
+
};
|
|
1538
|
+
},
|
|
1539
|
+
updatedAt
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1522
1542
|
deleteComment(threadId, optimisticId, commentId, deletedAt) {
|
|
1523
1543
|
return this.#updateThread(
|
|
1524
1544
|
threadId,
|
|
@@ -1724,6 +1744,27 @@ function applyOptimisticUpdates_forThreadifications(baseThreadsDB, notifications
|
|
|
1724
1744
|
threadsDB.upsert(applyUpsertComment(thread, optimisticUpdate.comment));
|
|
1725
1745
|
break;
|
|
1726
1746
|
}
|
|
1747
|
+
case "edit-comment-metadata": {
|
|
1748
|
+
const thread = threadsDB.get(optimisticUpdate.threadId);
|
|
1749
|
+
if (thread === void 0) break;
|
|
1750
|
+
if (thread.updatedAt > optimisticUpdate.updatedAt) {
|
|
1751
|
+
break;
|
|
1752
|
+
}
|
|
1753
|
+
const existingComment = thread.comments.find(
|
|
1754
|
+
(c) => c.id === optimisticUpdate.commentId
|
|
1755
|
+
);
|
|
1756
|
+
if (existingComment === void 0) break;
|
|
1757
|
+
threadsDB.upsert(
|
|
1758
|
+
applyUpsertComment(thread, {
|
|
1759
|
+
...existingComment,
|
|
1760
|
+
metadata: {
|
|
1761
|
+
...existingComment.metadata,
|
|
1762
|
+
...optimisticUpdate.metadata
|
|
1763
|
+
}
|
|
1764
|
+
})
|
|
1765
|
+
);
|
|
1766
|
+
break;
|
|
1767
|
+
}
|
|
1727
1768
|
case "delete-comment": {
|
|
1728
1769
|
const thread = threadsDB.get(optimisticUpdate.threadId);
|
|
1729
1770
|
if (thread === void 0) break;
|
|
@@ -1930,7 +1971,20 @@ function applyUpsertComment(thread, comment) {
|
|
|
1930
1971
|
return updatedThread;
|
|
1931
1972
|
}
|
|
1932
1973
|
if (existingComment.deletedAt !== void 0) {
|
|
1933
|
-
|
|
1974
|
+
const updatedComment = {
|
|
1975
|
+
...existingComment,
|
|
1976
|
+
metadata: {
|
|
1977
|
+
...existingComment.metadata,
|
|
1978
|
+
...comment.metadata
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
const updatedComments = thread.comments.map(
|
|
1982
|
+
(c) => c.id === comment.id ? updatedComment : c
|
|
1983
|
+
);
|
|
1984
|
+
return {
|
|
1985
|
+
...thread,
|
|
1986
|
+
comments: updatedComments
|
|
1987
|
+
};
|
|
1934
1988
|
}
|
|
1935
1989
|
if (existingComment.editedAt === void 0 || comment.editedAt === void 0 || existingComment.editedAt <= comment.editedAt) {
|
|
1936
1990
|
const updatedComments = thread.comments.map(
|
|
@@ -3521,9 +3575,11 @@ function makeRoomContextBundle(client) {
|
|
|
3521
3575
|
useOthersMapped,
|
|
3522
3576
|
useOthersConnectionIds,
|
|
3523
3577
|
useOther,
|
|
3578
|
+
// prettier-ignore
|
|
3524
3579
|
useMutation,
|
|
3525
3580
|
useThreads,
|
|
3526
3581
|
useSearchComments,
|
|
3582
|
+
// prettier-ignore
|
|
3527
3583
|
useCreateThread,
|
|
3528
3584
|
useDeleteThread,
|
|
3529
3585
|
useEditThreadMetadata,
|
|
@@ -3533,6 +3589,7 @@ function makeRoomContextBundle(client) {
|
|
|
3533
3589
|
useUnsubscribeFromThread,
|
|
3534
3590
|
useCreateComment,
|
|
3535
3591
|
useEditComment,
|
|
3592
|
+
useEditCommentMetadata,
|
|
3536
3593
|
useDeleteComment,
|
|
3537
3594
|
useAddReaction,
|
|
3538
3595
|
useRemoveReaction,
|
|
@@ -3567,8 +3624,10 @@ function makeRoomContextBundle(client) {
|
|
|
3567
3624
|
useOthersMapped: useOthersMappedSuspense,
|
|
3568
3625
|
useOthersConnectionIds: useOthersConnectionIdsSuspense,
|
|
3569
3626
|
useOther: useOtherSuspense,
|
|
3627
|
+
// prettier-ignore
|
|
3570
3628
|
useMutation,
|
|
3571
3629
|
useThreads: useThreadsSuspense,
|
|
3630
|
+
// prettier-ignore
|
|
3572
3631
|
useCreateThread,
|
|
3573
3632
|
useDeleteThread,
|
|
3574
3633
|
useEditThreadMetadata,
|
|
@@ -3578,6 +3637,7 @@ function makeRoomContextBundle(client) {
|
|
|
3578
3637
|
useUnsubscribeFromThread,
|
|
3579
3638
|
useCreateComment,
|
|
3580
3639
|
useEditComment,
|
|
3640
|
+
useEditCommentMetadata,
|
|
3581
3641
|
useDeleteComment,
|
|
3582
3642
|
useAddReaction,
|
|
3583
3643
|
useRemoveReaction,
|
|
@@ -3682,6 +3742,7 @@ function RoomProviderInner(props) {
|
|
|
3682
3742
|
case ServerMsgCode.COMMENT_REACTION_ADDED:
|
|
3683
3743
|
case ServerMsgCode.COMMENT_REACTION_REMOVED:
|
|
3684
3744
|
case ServerMsgCode.COMMENT_DELETED:
|
|
3745
|
+
case ServerMsgCode.COMMENT_METADATA_UPDATED:
|
|
3685
3746
|
if (!existingThread) break;
|
|
3686
3747
|
store.updateThreadifications(
|
|
3687
3748
|
[thread],
|
|
@@ -4089,6 +4150,7 @@ function useCreateRoomThread(roomId) {
|
|
|
4089
4150
|
(options) => {
|
|
4090
4151
|
const body = options.body;
|
|
4091
4152
|
const metadata = options.metadata ?? {};
|
|
4153
|
+
const commentMetadata = options.commentMetadata ?? {};
|
|
4092
4154
|
const attachments = options.attachments;
|
|
4093
4155
|
const threadId = createThreadId();
|
|
4094
4156
|
const commentId = createCommentId();
|
|
@@ -4102,7 +4164,8 @@ function useCreateRoomThread(roomId) {
|
|
|
4102
4164
|
userId: getCurrentUserId(client),
|
|
4103
4165
|
body,
|
|
4104
4166
|
reactions: [],
|
|
4105
|
-
attachments: attachments ?? []
|
|
4167
|
+
attachments: attachments ?? [],
|
|
4168
|
+
metadata: commentMetadata
|
|
4106
4169
|
};
|
|
4107
4170
|
const newThread = {
|
|
4108
4171
|
id: threadId,
|
|
@@ -4127,6 +4190,7 @@ function useCreateRoomThread(roomId) {
|
|
|
4127
4190
|
commentId,
|
|
4128
4191
|
body,
|
|
4129
4192
|
metadata,
|
|
4193
|
+
commentMetadata,
|
|
4130
4194
|
attachmentIds
|
|
4131
4195
|
}).then(
|
|
4132
4196
|
(thread) => {
|
|
@@ -4140,7 +4204,8 @@ function useCreateRoomThread(roomId) {
|
|
|
4140
4204
|
threadId,
|
|
4141
4205
|
commentId,
|
|
4142
4206
|
body,
|
|
4143
|
-
metadata
|
|
4207
|
+
metadata,
|
|
4208
|
+
commentMetadata
|
|
4144
4209
|
},
|
|
4145
4210
|
err
|
|
4146
4211
|
)
|
|
@@ -4223,13 +4288,65 @@ function useEditRoomThreadMetadata(roomId) {
|
|
|
4223
4288
|
[client, roomId]
|
|
4224
4289
|
);
|
|
4225
4290
|
}
|
|
4291
|
+
function useEditCommentMetadata() {
|
|
4292
|
+
return useEditRoomCommentMetadata(useRoom().id);
|
|
4293
|
+
}
|
|
4294
|
+
function useEditRoomCommentMetadata(roomId) {
|
|
4295
|
+
const client = useClient();
|
|
4296
|
+
return useCallback3(
|
|
4297
|
+
(options) => {
|
|
4298
|
+
if (!options.metadata) {
|
|
4299
|
+
return;
|
|
4300
|
+
}
|
|
4301
|
+
const threadId = options.threadId;
|
|
4302
|
+
const commentId = options.commentId;
|
|
4303
|
+
const metadata = options.metadata;
|
|
4304
|
+
const updatedAt = /* @__PURE__ */ new Date();
|
|
4305
|
+
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4306
|
+
const optimisticId = store.optimisticUpdates.add({
|
|
4307
|
+
type: "edit-comment-metadata",
|
|
4308
|
+
threadId,
|
|
4309
|
+
commentId,
|
|
4310
|
+
metadata,
|
|
4311
|
+
updatedAt
|
|
4312
|
+
});
|
|
4313
|
+
client[kInternal4].httpClient.editCommentMetadata({ roomId, threadId, commentId, metadata }).then(
|
|
4314
|
+
(updatedMetadata) => (
|
|
4315
|
+
// Replace the optimistic update by the real thing
|
|
4316
|
+
store.editCommentMetadata(
|
|
4317
|
+
threadId,
|
|
4318
|
+
commentId,
|
|
4319
|
+
optimisticId,
|
|
4320
|
+
updatedMetadata,
|
|
4321
|
+
updatedAt
|
|
4322
|
+
)
|
|
4323
|
+
),
|
|
4324
|
+
(err) => onMutationFailure(
|
|
4325
|
+
optimisticId,
|
|
4326
|
+
{
|
|
4327
|
+
type: "EDIT_COMMENT_METADATA_ERROR",
|
|
4328
|
+
roomId,
|
|
4329
|
+
threadId,
|
|
4330
|
+
commentId,
|
|
4331
|
+
metadata
|
|
4332
|
+
},
|
|
4333
|
+
err
|
|
4334
|
+
)
|
|
4335
|
+
);
|
|
4336
|
+
},
|
|
4337
|
+
[client, roomId]
|
|
4338
|
+
);
|
|
4339
|
+
}
|
|
4226
4340
|
function useCreateComment() {
|
|
4227
4341
|
return useCreateRoomComment(useRoom().id);
|
|
4228
4342
|
}
|
|
4229
4343
|
function useCreateRoomComment(roomId) {
|
|
4230
4344
|
const client = useClient();
|
|
4231
4345
|
return useCallback3(
|
|
4232
|
-
(
|
|
4346
|
+
(options) => {
|
|
4347
|
+
const { threadId, body } = options;
|
|
4348
|
+
const metadata = options.metadata ?? {};
|
|
4349
|
+
const attachments = options.attachments ?? [];
|
|
4233
4350
|
const commentId = createCommentId();
|
|
4234
4351
|
const createdAt = /* @__PURE__ */ new Date();
|
|
4235
4352
|
const comment = {
|
|
@@ -4241,7 +4358,8 @@ function useCreateRoomComment(roomId) {
|
|
|
4241
4358
|
userId: getCurrentUserId(client),
|
|
4242
4359
|
body,
|
|
4243
4360
|
reactions: [],
|
|
4244
|
-
attachments: attachments ?? []
|
|
4361
|
+
attachments: attachments ?? [],
|
|
4362
|
+
metadata
|
|
4245
4363
|
};
|
|
4246
4364
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4247
4365
|
const optimisticId = store.optimisticUpdates.add({
|
|
@@ -4249,7 +4367,14 @@ function useCreateRoomComment(roomId) {
|
|
|
4249
4367
|
comment
|
|
4250
4368
|
});
|
|
4251
4369
|
const attachmentIds = attachments?.map((attachment) => attachment.id);
|
|
4252
|
-
client[kInternal4].httpClient.createComment({
|
|
4370
|
+
client[kInternal4].httpClient.createComment({
|
|
4371
|
+
roomId,
|
|
4372
|
+
threadId,
|
|
4373
|
+
commentId,
|
|
4374
|
+
body,
|
|
4375
|
+
metadata,
|
|
4376
|
+
attachmentIds
|
|
4377
|
+
}).then(
|
|
4253
4378
|
(newComment) => {
|
|
4254
4379
|
store.createComment(newComment, optimisticId);
|
|
4255
4380
|
},
|
|
@@ -4260,7 +4385,8 @@ function useCreateRoomComment(roomId) {
|
|
|
4260
4385
|
roomId,
|
|
4261
4386
|
threadId,
|
|
4262
4387
|
commentId,
|
|
4263
|
-
body
|
|
4388
|
+
body,
|
|
4389
|
+
metadata
|
|
4264
4390
|
},
|
|
4265
4391
|
err
|
|
4266
4392
|
)
|
|
@@ -4276,7 +4402,13 @@ function useEditComment() {
|
|
|
4276
4402
|
function useEditRoomComment(roomId) {
|
|
4277
4403
|
const client = useClient();
|
|
4278
4404
|
return useCallback3(
|
|
4279
|
-
({
|
|
4405
|
+
({
|
|
4406
|
+
threadId,
|
|
4407
|
+
commentId,
|
|
4408
|
+
body,
|
|
4409
|
+
attachments,
|
|
4410
|
+
metadata
|
|
4411
|
+
}) => {
|
|
4280
4412
|
const editedAt = /* @__PURE__ */ new Date();
|
|
4281
4413
|
const { store, onMutationFailure } = getRoomExtrasForClient(client);
|
|
4282
4414
|
const existing = store.outputs.threads.get().getEvenIfDeleted(threadId);
|
|
@@ -4295,23 +4427,42 @@ function useEditRoomComment(roomId) {
|
|
|
4295
4427
|
);
|
|
4296
4428
|
return;
|
|
4297
4429
|
}
|
|
4430
|
+
const updatedMetadata = metadata !== void 0 ? {
|
|
4431
|
+
...comment.metadata,
|
|
4432
|
+
...metadata
|
|
4433
|
+
} : comment.metadata;
|
|
4298
4434
|
const optimisticId = store.optimisticUpdates.add({
|
|
4299
4435
|
type: "edit-comment",
|
|
4300
4436
|
comment: {
|
|
4301
4437
|
...comment,
|
|
4302
4438
|
editedAt,
|
|
4303
4439
|
body,
|
|
4304
|
-
attachments: attachments ?? []
|
|
4440
|
+
attachments: attachments ?? [],
|
|
4441
|
+
metadata: updatedMetadata
|
|
4305
4442
|
}
|
|
4306
4443
|
});
|
|
4307
4444
|
const attachmentIds = attachments?.map((attachment) => attachment.id);
|
|
4308
|
-
client[kInternal4].httpClient.editComment({
|
|
4445
|
+
client[kInternal4].httpClient.editComment({
|
|
4446
|
+
roomId,
|
|
4447
|
+
threadId,
|
|
4448
|
+
commentId,
|
|
4449
|
+
body,
|
|
4450
|
+
attachmentIds,
|
|
4451
|
+
metadata
|
|
4452
|
+
}).then(
|
|
4309
4453
|
(editedComment) => {
|
|
4310
4454
|
store.editComment(threadId, optimisticId, editedComment);
|
|
4311
4455
|
},
|
|
4312
4456
|
(err) => onMutationFailure(
|
|
4313
4457
|
optimisticId,
|
|
4314
|
-
{
|
|
4458
|
+
{
|
|
4459
|
+
type: "EDIT_COMMENT_ERROR",
|
|
4460
|
+
roomId,
|
|
4461
|
+
threadId,
|
|
4462
|
+
commentId,
|
|
4463
|
+
body,
|
|
4464
|
+
metadata: updatedMetadata
|
|
4465
|
+
},
|
|
4315
4466
|
err
|
|
4316
4467
|
)
|
|
4317
4468
|
);
|
|
@@ -4936,6 +5087,9 @@ var _useMutation = useMutation;
|
|
|
4936
5087
|
var _useCreateThread = useCreateThread;
|
|
4937
5088
|
var _useDeleteThread = useDeleteThread;
|
|
4938
5089
|
var _useEditThreadMetadata = useEditThreadMetadata;
|
|
5090
|
+
var _useCreateComment = useCreateComment;
|
|
5091
|
+
var _useEditComment = useEditComment;
|
|
5092
|
+
var _useEditCommentMetadata = useEditCommentMetadata;
|
|
4939
5093
|
var _useEventListener = useEventListener;
|
|
4940
5094
|
var _useMyPresence = useMyPresence;
|
|
4941
5095
|
var _useOthersMapped = useOthersMapped;
|
|
@@ -5030,9 +5184,7 @@ export {
|
|
|
5030
5184
|
useCreateRoomThread,
|
|
5031
5185
|
useDeleteRoomThread,
|
|
5032
5186
|
useEditRoomThreadMetadata,
|
|
5033
|
-
useCreateComment,
|
|
5034
5187
|
useCreateRoomComment,
|
|
5035
|
-
useEditComment,
|
|
5036
5188
|
useEditRoomComment,
|
|
5037
5189
|
useDeleteComment,
|
|
5038
5190
|
useDeleteRoomComment,
|
|
@@ -5067,6 +5219,9 @@ export {
|
|
|
5067
5219
|
_useCreateThread,
|
|
5068
5220
|
_useDeleteThread,
|
|
5069
5221
|
_useEditThreadMetadata,
|
|
5222
|
+
_useCreateComment,
|
|
5223
|
+
_useEditComment,
|
|
5224
|
+
_useEditCommentMetadata,
|
|
5070
5225
|
_useEventListener,
|
|
5071
5226
|
_useMyPresence,
|
|
5072
5227
|
_useOthersMapped,
|
|
@@ -5089,4 +5244,4 @@ export {
|
|
|
5089
5244
|
_useStorageRoot,
|
|
5090
5245
|
_useUpdateMyPresence
|
|
5091
5246
|
};
|
|
5092
|
-
//# sourceMappingURL=chunk-
|
|
5247
|
+
//# sourceMappingURL=chunk-LGJ7R5KY.js.map
|