Skip to content

Commit a147c9e

Browse files
author
anakin_karrot
committed
correct
1 parent 9d0f3a3 commit a147c9e

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

extensions/plugin-history-sync/src/historySyncPlugin.tsx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -342,31 +342,38 @@ export function historySyncPlugin<
342342
]);
343343
} else {
344344
initialSetupProcess = new SerialNavigationProcess([
345-
...defaultHistory.map((historyEntry) => () => {
346-
const events = historyEntryToEvents(historyEntry);
347-
348-
for (const event of events) {
349-
if (event.name === "Pushed") {
350-
activityActivationMonitors.push(
351-
new DefaultHistoryActivityActivationMonitor(
352-
event.activityId,
353-
initialSetupProcess!,
354-
),
355-
);
356-
}
357-
}
358-
359-
return events;
345+
...defaultHistory.map((historyEntry, index) => () => {
346+
let isFirstPush = true;
347+
348+
return historyEntryToEvents(historyEntry).map((event) => {
349+
if (event.name !== "Pushed") return event;
350+
const skipEnterActiveState = index === 0 && isFirstPush;
351+
352+
isFirstPush = false;
353+
activityActivationMonitors.push(
354+
new DefaultHistoryActivityActivationMonitor(
355+
event.activityId,
356+
initialSetupProcess!,
357+
),
358+
);
359+
360+
return {
361+
...event,
362+
skipEnterActiveState,
363+
};
364+
});
360365
}),
361366
() => [createTargetActivityPushEvent()],
362367
]);
363368
}
364369

370+
const now = Date.now();
371+
365372
return initialSetupProcess
366373
.captureNavigationOpportunity(null)
367-
.map((event, index) => ({
374+
.map((event, index, array) => ({
368375
...event,
369-
eventDate: Date.now() - MINUTE + index,
376+
eventDate: now - (array.length - index),
370377
}));
371378
},
372379
onInit({ actions: { getStack, dispatchEvent, push, stepPush } }) {

0 commit comments

Comments
 (0)