-
Notifications
You must be signed in to change notification settings - Fork 112
feat(core,plugin-history-sync): allow step actions for non-top activities #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
980c183
7696863
42cde0f
398bcf8
8f5a022
ae7c98d
289cd62
a8167c8
57b087f
d951a66
8807c12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -395,6 +395,58 @@ export function historySyncPlugin< | |||||||||||||||||||||||||||||||||||||
| (step) => step.id === targetStep?.id, | ||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // Synchronize history state with core state for lower activity step modifications | ||||||||||||||||||||||||||||||||||||||
| if (nextActivity) { | ||||||||||||||||||||||||||||||||||||||
| const coreSteps = nextActivity.steps; | ||||||||||||||||||||||||||||||||||||||
| const coreLastStep = last(coreSteps); | ||||||||||||||||||||||||||||||||||||||
| const historyStep = targetStep; | ||||||||||||||||||||||||||||||||||||||
| const historySteps = targetActivity.steps; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // Check if history step exists in core state | ||||||||||||||||||||||||||||||||||||||
| const historyStepExistsInCore = historyStep | ||||||||||||||||||||||||||||||||||||||
| ? coreSteps.some((step) => step.id === historyStep.id) | ||||||||||||||||||||||||||||||||||||||
| : true; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (!historyStepExistsInCore) { | ||||||||||||||||||||||||||||||||||||||
| // History step was removed or replaced | ||||||||||||||||||||||||||||||||||||||
| if (coreSteps.length < historySteps.length) { | ||||||||||||||||||||||||||||||||||||||
| // Step Pop: Step count decreased | ||||||||||||||||||||||||||||||||||||||
| // Use history.back() to skip the removed step entry | ||||||||||||||||||||||||||||||||||||||
| requestHistoryTick(() => { | ||||||||||||||||||||||||||||||||||||||
| silentFlag = true; | ||||||||||||||||||||||||||||||||||||||
| history.back(); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
| if (coreSteps.length < historySteps.length) { | |
| // Step Pop: Step count decreased | |
| // Use history.back() to skip the removed step entry | |
| requestHistoryTick(() => { | |
| silentFlag = true; | |
| history.back(); | |
| }); | |
| return; | |
| if (coreSteps.length < historySteps.length) { | |
| // Step Pop: jump back by the exact number of removed steps | |
| const popDelta = historySteps.length - coreSteps.length; | |
| if (popDelta > 0) { | |
| requestHistoryTick(() => { | |
| silentFlag = true; | |
| history.go(-popDelta); | |
| }); | |
| } | |
| return; |
🤖 Prompt for AI Agents
In extensions/plugin-history-sync/src/historySyncPlugin.tsx around lines 414 to
421, the code only calls history.back() when coreSteps.length <
historySteps.length which only moves back one entry; compute the exact delta =
historySteps.length - coreSteps.length and inside the requestHistoryTick
callback set silentFlag = true and call history.go(-delta) so the browser jumps
back by the full number of removed entries (then return as before).
Uh oh!
There was an error while loading. Please reload this page.