@liveblocks/react 3.23.0-file2 → 3.23.0-file3
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-4Y44J4GN.js → chunk-2HI5KTUG.js} +2 -2
- package/dist/{chunk-DKLVP4PZ.cjs → chunk-BBTWUT5M.cjs} +2 -2
- package/dist/{chunk-DKLVP4PZ.cjs.map → chunk-BBTWUT5M.cjs.map} +1 -1
- package/dist/{chunk-L5JH73RJ.cjs → chunk-D3V3GO4R.cjs} +33 -8
- package/dist/chunk-D3V3GO4R.cjs.map +1 -0
- package/dist/{chunk-CTG3FMRO.js → chunk-K33MUAUO.js} +32 -7
- package/dist/chunk-K33MUAUO.js.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 +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{room-BRD10hWb.d.cts → room-DUr5FIYB.d.cts} +20 -2
- package/dist/{room-BRD10hWb.d.ts → room-DUr5FIYB.d.ts} +20 -2
- 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 +5 -3
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-CTG3FMRO.js.map +0 -1
- package/dist/chunk-L5JH73RJ.cjs.map +0 -1
- /package/dist/{chunk-4Y44J4GN.js.map → chunk-2HI5KTUG.js.map} +0 -0
|
@@ -4310,6 +4310,16 @@ function useMutation(callback, deps) {
|
|
|
4310
4310
|
deps
|
|
4311
4311
|
);
|
|
4312
4312
|
}
|
|
4313
|
+
function useUploadFile_withRoomContext(RoomContext) {
|
|
4314
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4315
|
+
return useCallback3(
|
|
4316
|
+
(file, options) => room.uploadFile(file, options),
|
|
4317
|
+
[room]
|
|
4318
|
+
);
|
|
4319
|
+
}
|
|
4320
|
+
function useUploadFile() {
|
|
4321
|
+
return useUploadFile_withRoomContext(GlobalRoomContext);
|
|
4322
|
+
}
|
|
4313
4323
|
function useThreads_withRoomContext(RoomContext, options = {}) {
|
|
4314
4324
|
const { scrollOnLoad = true } = options;
|
|
4315
4325
|
const client = useClient();
|
|
@@ -5643,7 +5653,7 @@ function selectorFor_useFileUrl(state) {
|
|
|
5643
5653
|
assert2(state.data !== void 0, "Unexpected missing file URL");
|
|
5644
5654
|
return {
|
|
5645
5655
|
isLoading: false,
|
|
5646
|
-
url: state.data
|
|
5656
|
+
url: state.data.url
|
|
5647
5657
|
};
|
|
5648
5658
|
}
|
|
5649
5659
|
function useAttachmentUrl_withRoomContext(RoomContext, attachmentId) {
|
|
@@ -5686,16 +5696,19 @@ function useRoomFileUrl(file, roomId) {
|
|
|
5686
5696
|
() => store.getItemState(fileId),
|
|
5687
5697
|
[store, fileId]
|
|
5688
5698
|
);
|
|
5689
|
-
|
|
5690
|
-
void store.enqueue(fileId);
|
|
5691
|
-
}, [store, fileId]);
|
|
5692
|
-
return useSyncExternalStoreWithSelector(
|
|
5699
|
+
const result = useSyncExternalStoreWithSelector(
|
|
5693
5700
|
store.subscribe,
|
|
5694
5701
|
getFileUrlState,
|
|
5695
5702
|
getFileUrlState,
|
|
5696
5703
|
selectorFor_useFileUrl,
|
|
5697
5704
|
shallow4
|
|
5698
5705
|
);
|
|
5706
|
+
useEffect6(() => {
|
|
5707
|
+
if (result.isLoading) {
|
|
5708
|
+
void store.enqueue(fileId);
|
|
5709
|
+
}
|
|
5710
|
+
}, [store, fileId, result.isLoading]);
|
|
5711
|
+
return result;
|
|
5699
5712
|
}
|
|
5700
5713
|
function useAttachmentUrlSuspense_withRoomContext(RoomContext, attachmentId) {
|
|
5701
5714
|
const room = useRoom_withRoomContext(RoomContext);
|
|
@@ -5744,6 +5757,10 @@ function useFileUrlSuspense_withRoomContext(RoomContext, file) {
|
|
|
5744
5757
|
throw fileUrlsStore.enqueue(fileId);
|
|
5745
5758
|
}
|
|
5746
5759
|
if (fileUrlState.error) {
|
|
5760
|
+
const cacheExpiry$ = fileUrlsStore.waitUntilItemCacheExpires(fileId);
|
|
5761
|
+
if (cacheExpiry$ !== void 0) {
|
|
5762
|
+
throw cacheExpiry$;
|
|
5763
|
+
}
|
|
5747
5764
|
throw fileUrlState.error;
|
|
5748
5765
|
}
|
|
5749
5766
|
const state = useSyncExternalStore3(
|
|
@@ -5756,7 +5773,7 @@ function useFileUrlSuspense_withRoomContext(RoomContext, file) {
|
|
|
5756
5773
|
assert2(!state.error, "Unexpected error state");
|
|
5757
5774
|
return {
|
|
5758
5775
|
isLoading: false,
|
|
5759
|
-
url: state.data,
|
|
5776
|
+
url: state.data.url,
|
|
5760
5777
|
error: void 0
|
|
5761
5778
|
};
|
|
5762
5779
|
}
|
|
@@ -5903,6 +5920,9 @@ function createRoomContext(client) {
|
|
|
5903
5920
|
...args
|
|
5904
5921
|
);
|
|
5905
5922
|
}
|
|
5923
|
+
function useUploadFile_withBoundRoomContext() {
|
|
5924
|
+
return useUploadFile_withRoomContext(BoundRoomContext);
|
|
5925
|
+
}
|
|
5906
5926
|
function useThreads_withBoundRoomContext(...args) {
|
|
5907
5927
|
return useThreads_withRoomContext(BoundRoomContext, ...args);
|
|
5908
5928
|
}
|
|
@@ -6067,6 +6087,8 @@ function createRoomContext(client) {
|
|
|
6067
6087
|
// prettier-ignore
|
|
6068
6088
|
useMutation: useMutation_withBoundRoomContext,
|
|
6069
6089
|
// prettier-ignore
|
|
6090
|
+
useUploadFile: useUploadFile_withBoundRoomContext,
|
|
6091
|
+
// prettier-ignore
|
|
6070
6092
|
useSelf: useSelf_withBoundRoomContext,
|
|
6071
6093
|
// prettier-ignore
|
|
6072
6094
|
useMyPresence: useMyPresence_withBoundRoomContext,
|
|
@@ -6182,6 +6204,8 @@ function createRoomContext(client) {
|
|
|
6182
6204
|
// prettier-ignore
|
|
6183
6205
|
useMutation: useMutation_withBoundRoomContext,
|
|
6184
6206
|
// prettier-ignore
|
|
6207
|
+
useUploadFile: useUploadFile_withBoundRoomContext,
|
|
6208
|
+
// prettier-ignore
|
|
6185
6209
|
useSelf: useSelfSuspense_withBoundRoomContext,
|
|
6186
6210
|
// prettier-ignore
|
|
6187
6211
|
useMyPresence: useMyPresence_withBoundRoomContext,
|
|
@@ -6371,6 +6395,7 @@ export {
|
|
|
6371
6395
|
useCanUndo,
|
|
6372
6396
|
useCanRedo,
|
|
6373
6397
|
useOthersConnectionIds,
|
|
6398
|
+
useUploadFile,
|
|
6374
6399
|
useCreateFeed,
|
|
6375
6400
|
useDeleteFeed,
|
|
6376
6401
|
useUpdateFeedMetadata,
|
|
@@ -6454,4 +6479,4 @@ export {
|
|
|
6454
6479
|
_useStorageRoot,
|
|
6455
6480
|
_useUpdateMyPresence
|
|
6456
6481
|
};
|
|
6457
|
-
//# sourceMappingURL=chunk-
|
|
6482
|
+
//# sourceMappingURL=chunk-K33MUAUO.js.map
|