@@ -166,10 +166,14 @@ export const fetchBlobs = async (paths, query) => {
166166
167167 // Fetch all the text contents with the GraphQL API. Pagination would fail if `paths` becomes too
168168 // long, so we just use a fixed number of paths to iterate. The complexity score of this query is
169- // 15 + (2 * node size) so 100 paths = 215 complexity, where the max number of records is 100 and
170- // max complexity is 250 or 300
169+ // 15 + (2 * node size) so 50 paths = 115 complexity, giving the following conditions:
170+ // 1. The max number of records is 100
171+ // 2. The max query complexity is 250 or 300
172+ // 3. The total blob size must be under 20 MB (since GitLab 18.4.5)
173+ // @see https://github.com/sveltia/sveltia-cms/issues/525
174+ // @see https://gitlab.com/gitlab-org/gitlab/-/issues/576497
171175 for ( ; ; ) {
172- const currentPaths = fetchingPaths . splice ( 0 , 100 ) ;
176+ const currentPaths = fetchingPaths . splice ( 0 , 50 ) ;
173177
174178 const result = /** @type {FetchBlobsResponse } */ (
175179 await fetchGraphQL ( query , { paths : currentPaths } )
@@ -307,14 +311,12 @@ export const fetchFileContents = async (fetchingFiles) => {
307311 dataLoadedProgress . update ( ( progress = 0 ) => progress + 1 ) ;
308312 } , fetchingFiles . length ) ;
309313
310- const [ sizes , blobs , commits ] = await Promise . all ( [
311- // Fetch sizes for all files
312- fetchBlobs ( allPaths , FETCH_BLOBS_QUERY . replace ( 'rawTextBlob' , 'size' ) ) ,
313- // Fetch blobs for entry/config files only
314- fetchBlobs ( textPaths , FETCH_BLOBS_QUERY ) ,
315- // Fetch commit info only when there aren’t many files, because it’s costly
316- allPaths . length < 100 ? fetchCommits ( allPaths ) : Promise . resolve ( { } ) ,
317- ] ) ;
314+ // Fetch sizes for all files
315+ const sizes = await fetchBlobs ( allPaths , FETCH_BLOBS_QUERY . replace ( 'rawTextBlob' , 'size' ) ) ;
316+ // Fetch blobs for entry/config files only
317+ const blobs = await fetchBlobs ( textPaths , FETCH_BLOBS_QUERY ) ;
318+ // Fetch commit info only when there aren’t many files, because it’s costly
319+ const commits = allPaths . length < 100 ? await fetchCommits ( allPaths ) : { } ;
318320
319321 window . clearInterval ( dataLoadedProgressInterval ) ;
320322 dataLoadedProgress . set ( undefined ) ;
0 commit comments