@@ -394,7 +394,7 @@ const getAPIContextId = async () => {
394
394
* Get a revision by its ID.
395
395
*/
396
396
export const getRevision = cache ( {
397
- name : 'api.getRevision.v3 ' ,
397
+ name : 'api.getRevision.v2 ' ,
398
398
tag : ( spaceId , revisionId , fetchOptions ) =>
399
399
// Temporary hack to make it work with OpenAPI on v1
400
400
fetchOptions . tags ?. [ 0 ] ??
@@ -427,19 +427,24 @@ export const getRevision = cache({
427
427
return cacheResponse ( response , {
428
428
...( fetchOptions . metadata ? cacheTtl_7days : cacheTtl_1day ) ,
429
429
data : {
430
- revision : response . data ,
430
+ ... response . data ,
431
431
tags : getResponseCacheTags ( response ) ,
432
432
} ,
433
433
} ) ;
434
434
} ,
435
- getKeyArgs : ( args ) => [ args [ 0 ] , args [ 1 ] ] ,
435
+ getKeyArgs : ( [ spaceId , revisionId , fetchOptions ] ) => {
436
+ if ( fetchOptions . computed === false ) {
437
+ return [ spaceId , revisionId , { computed : false } ] ;
438
+ }
439
+ return [ spaceId , revisionId ] ;
440
+ } ,
436
441
} ) ;
437
442
438
443
/**
439
444
* Get all the pages in a revision of a space.
440
445
*/
441
446
export const getRevisionPages = cache ( {
442
- name : 'api.getRevisionPages.v5 ' ,
447
+ name : 'api.getRevisionPages.v4 ' ,
443
448
tag : ( spaceId , revisionId , fetchOptions ) =>
444
449
// Temporary hack to make it work with OpenAPI on v1
445
450
fetchOptions . tags ?. [ 0 ] ??
@@ -471,10 +476,15 @@ export const getRevisionPages = cache({
471
476
472
477
return cacheResponse ( response , {
473
478
...( fetchOptions . metadata ? cacheTtl_7days : cacheTtl_1day ) ,
474
- data : { pages : response . data . pages , tags : getResponseCacheTags ( response ) } ,
479
+ data : { ... response . data , tags : getResponseCacheTags ( response ) } ,
475
480
} ) ;
476
481
} ,
477
- getKeyArgs : ( args ) => [ args [ 0 ] , args [ 1 ] ] ,
482
+ getKeyArgs : ( [ spaceId , revisionId , fetchOptions ] ) => {
483
+ if ( fetchOptions . computed === false ) {
484
+ return [ spaceId , revisionId , { computed : false } ] ;
485
+ }
486
+ return [ spaceId , revisionId ] ;
487
+ } ,
478
488
} ) ;
479
489
480
490
/**
@@ -663,7 +673,7 @@ export const getRevisionFile = batch<[string, string, string], RevisionFile | nu
663
673
let files : Record < string , RevisionFile > = { } ;
664
674
665
675
if ( hasRevisionInMemory ) {
666
- const { revision } = await getRevision ( spaceId , revisionId , { metadata : false } ) ;
676
+ const revision = await getRevision ( spaceId , revisionId , { metadata : false } ) ;
667
677
files = { } ;
668
678
revision . files . forEach ( ( file ) => {
669
679
files [ file . id ] = file ;
@@ -709,7 +719,7 @@ export const getReusableContent = async (
709
719
} ) ;
710
720
711
721
if ( hasRevisionInMemory ) {
712
- const { revision } = await getRevision ( spaceId , revisionId , { metadata : false } ) ;
722
+ const revision = await getRevision ( spaceId , revisionId , { metadata : false } ) ;
713
723
return (
714
724
revision . reusableContents . find (
715
725
( reusableContent ) => reusableContent . id === reusableContentId
0 commit comments