@@ -14,7 +14,9 @@ import type { Serialization } from './serialization';
1414
1515export interface IAppReact {
1616 pathPageIds : string [ ] ;
17- recentPageIds : string [ ] ;
17+
18+ recentPageIdsOverride ?: string [ ] ;
19+ recentPageIds : ComputedRef < string [ ] > ;
1820
1921 page : ShallowRef < Page > ;
2022 pageId : ComputedRef < string | undefined > ;
@@ -42,6 +44,8 @@ export class Pages {
4244
4345 parentPageId ?: string ;
4446
47+ recentPageIdsKeepOverride ?: boolean ;
48+
4549 constructor ( input : { factories : Factories } ) {
4650 this . factories = input . factories ;
4751
@@ -50,7 +54,21 @@ export class Pages {
5054
5155 this . react = reactive ( {
5256 pathPageIds : [ ] ,
53- recentPageIds : [ ] ,
57+ recentPageIds : computed ( ( ) => {
58+ if ( this . recentPageIdsKeepOverride ) {
59+ this . recentPageIdsKeepOverride = undefined ;
60+ } else {
61+ this . react . recentPageIdsOverride = undefined ;
62+ }
63+
64+ const recentPageIds = internals . realtime . globalCtx . hget (
65+ 'user' ,
66+ authStore ( ) . userId ,
67+ 'recent-page-ids' ,
68+ ) ;
69+
70+ return this . react . recentPageIdsOverride ?? recentPageIds ?? [ ] ;
71+ } ) ,
5472
5573 page : shallowRef ( null ) as any ,
5674 pageId : computed ( ( ) => this . react . page ?. id ) ,
@@ -82,17 +100,12 @@ export class Pages {
82100
83101 promises . push (
84102 ( async ( ) => {
85- const [
86- encryptedDefaultNote ,
87- encryptedDefaultArrow ,
88- recentPageIdsJSON ,
89- isNewUser ,
90- ] = await internals . realtime . hmget ( 'user' , authStore ( ) . userId , [
91- 'encrypted-default-note' ,
92- 'encrypted-default-arrow' ,
93- 'recent-page-ids' ,
94- 'new' ,
95- ] ) ;
103+ const [ encryptedDefaultNote , encryptedDefaultArrow , isNewUser ] =
104+ await internals . realtime . hmget ( 'user' , authStore ( ) . userId , [
105+ 'encrypted-default-note' ,
106+ 'encrypted-default-arrow' ,
107+ 'new' ,
108+ ] ) ;
96109
97110 this . defaultNote = unpack (
98111 internals . symmetricKeyring . decrypt ( encryptedDefaultNote , {
@@ -113,8 +126,6 @@ export class Pages {
113126 } ) ,
114127 ) ;
115128
116- this . react . recentPageIds = recentPageIdsJSON ?? [ ] ;
117-
118129 this . react . isNewUser = ! ! isNewUser ;
119130
120131 if ( isNewUser ) {
0 commit comments