File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ export const useAccessStore = createPersistStore(
210
210
} )
211
211
. then ( ( res : DangerConfig ) => {
212
212
console . log ( "[Config] got config from server" , res ) ;
213
- set ( ( ) => ( { ...res } ) ) ;
213
+ set ( ( ) => ( { lastUpdateTime : Date . now ( ) , ...res } ) ) ;
214
214
} )
215
215
. catch ( ( ) => {
216
216
console . error ( "[Config] failed to fetch config" ) ;
Original file line number Diff line number Diff line change @@ -128,7 +128,13 @@ const MergeStates: StateMerger = {
128
128
} ) ;
129
129
130
130
const remoteDeletedSessionIds = remoteState . deletedSessionIds || { } ;
131
+
132
+ const finalIds : Record < string , any > = { } ;
131
133
localState . sessions = localState . sessions . filter ( ( localSession ) => {
134
+ if ( finalIds [ localSession . id ] ) {
135
+ return false ;
136
+ }
137
+ finalIds [ localSession . id ] = true ;
132
138
return (
133
139
( remoteDeletedSessionIds [ localSession . id ] || - 1 ) <=
134
140
localSession . lastUpdate
@@ -209,9 +215,9 @@ export function mergeWithUpdate<T extends { lastUpdateTime?: number }>(
209
215
remoteState : T ,
210
216
) {
211
217
const localUpdateTime = localState . lastUpdateTime ?? 0 ;
212
- const remoteUpdateTime = localState . lastUpdateTime ?? 1 ;
218
+ const remoteUpdateTime = remoteState . lastUpdateTime ?? 1 ;
213
219
214
- if ( localUpdateTime < remoteUpdateTime ) {
220
+ if ( localUpdateTime >= remoteUpdateTime ) {
215
221
merge ( remoteState , localState ) ;
216
222
return { ...remoteState } ;
217
223
} else {
You can’t perform that action at this time.
0 commit comments