Skip to content

Commit acb753f

Browse files
authoredMar 14, 2025··
refactor(releases): speed up loading of documents in archived release (#8936)
1 parent 1a064d4 commit acb753f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import {
77
import {uuid} from '@sanity/uuid'
88
import {useMemo} from 'react'
99
import {useObservable} from 'react-rx'
10-
import {combineLatest, from, type Observable, of} from 'rxjs'
10+
import {combineLatest, type Observable, of} from 'rxjs'
1111
import {
1212
catchError,
13-
concatMap,
1413
distinctUntilChanged,
1514
expand,
1615
filter,
@@ -21,7 +20,6 @@ import {
2120
switchAll,
2221
switchMap,
2322
take,
24-
toArray,
2523
} from 'rxjs/operators'
2624
import {mergeMapArray} from 'rxjs-mergemap-array'
2725

@@ -214,8 +212,8 @@ const getPublishedArchivedReleaseDocumentsObservable = ({
214212

215213
return documents$.pipe(
216214
mergeMap((documents) => {
217-
return from(documents).pipe(
218-
concatMap((document) => {
215+
return combineLatest(
216+
documents.map((document) => {
219217
const schemaType = schema.get(document._type)
220218
if (!schemaType) {
221219
throw new Error(`Schema type not found for document type ${document._type}`)
@@ -239,7 +237,7 @@ const getPublishedArchivedReleaseDocumentsObservable = ({
239237
})),
240238
)
241239
}),
242-
toArray(),
240+
).pipe(
243241
map((results) => ({
244242
loading: false,
245243
results,

0 commit comments

Comments
 (0)
Please sign in to comment.