Comfy-Org / Comfy-Org/ComfyUI_frontend

Exiting a subgraph via undo requires an extra undo step (pinned in changeTracker.spec.ts since 2026-07-22, untracked)

Open
#15,749 0 comments 0 reactions 1 assignee Claimed by @AustinMroz View on GitHub
area:subgraph area:undo-redo Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Exiting a subgraph via undo requires one more undo step than expected. The behavior is pinned inside a browser test comment but has no tracking issue.

`browser_tests/tests/changeTracker.spec.ts`, test `Does not restore invalid navigation stack` (added in #13327, 2026-07-22), ends with:

```ts
await undoAndWait()
await undoAndWait()
await expect
.poll(
() => comfyPage.subgraph.isInSubgraph(),
'Currently bugged: click after subgraph requires additional undo'
)
.toBe(false)
```

The test needs two undo calls where the user-visible expectation is one. The "Currently bugged" annotation has lived only in that poll message since 2026-07-22; searching open issues for it returns nothing.

## Expected

One undo step after a subgraph conversion sequence returns the canvas to the parent/root scope, matching the number of user actions taken.

## Where

- `browser_tests/tests/changeTracker.spec.ts` final poll of `Does not restore invalid navigation stack` (present on both `main` 296fc5cd07 and `feature/ecs-migration` f1bfb313d6, verified 2026-08-23)
- Undo path: `ChangeTracker.updateState` replays serialized JSON via `app.loadGraphData`; navigation stack validation happens in `restore()` only on workflow switch, not on undo

## Notes

Found during an undo-coverage audit in the ECS migration program (task ax-12). This is a main-line behavior, not introduced by the ECS branch. If a fix lands, the test's double `undoAndWait()` and the poll message should be updated in the same PR so the characterisation does not fossilise the defect.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.