@@ -14,7 +14,9 @@ import type { Serialization } from './serialization';
14
14
15
15
export interface IAppReact {
16
16
pathPageIds : string [ ] ;
17
- recentPageIds : string [ ] ;
17
+
18
+ recentPageIdsOverride ?: string [ ] ;
19
+ recentPageIds : ComputedRef < string [ ] > ;
18
20
19
21
page : ShallowRef < Page > ;
20
22
pageId : ComputedRef < string | undefined > ;
@@ -42,6 +44,8 @@ export class Pages {
42
44
43
45
parentPageId ?: string ;
44
46
47
+ recentPageIdsKeepOverride ?: boolean ;
48
+
45
49
constructor ( input : { factories : Factories } ) {
46
50
this . factories = input . factories ;
47
51
@@ -50,7 +54,21 @@ export class Pages {
50
54
51
55
this . react = reactive ( {
52
56
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
+ } ) ,
54
72
55
73
page : shallowRef ( null ) as any ,
56
74
pageId : computed ( ( ) => this . react . page ?. id ) ,
@@ -82,17 +100,12 @@ export class Pages {
82
100
83
101
promises . push (
84
102
( 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
+ ] ) ;
96
109
97
110
this . defaultNote = unpack (
98
111
internals . symmetricKeyring . decrypt ( encryptedDefaultNote , {
@@ -113,8 +126,6 @@ export class Pages {
113
126
} ) ,
114
127
) ;
115
128
116
- this . react . recentPageIds = recentPageIdsJSON ?? [ ] ;
117
-
118
129
this . react . isNewUser = ! ! isNewUser ;
119
130
120
131
if ( isNewUser ) {
0 commit comments