-
Notifications
You must be signed in to change notification settings - Fork 518
fix: simplify ensureCorrectLayoutScale and fix link sync during Vue node drag #9680
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
dbd76a0
fix: make ensureCorrectLayoutScale idempotent to prevent node layout …
DrJKL 98b77db
refactor: simplify ensureCorrectLayoutScale to one-time normalizer
DrJKL 9e72a6e
fix: sync layout change notifications synchronously
DrJKL 751cd9b
refactor: remove unused project* exports and simplify review findings
DrJKL 56829f2
fix: extract MIN_NODE_WIDTH constant and sync inner wrapper min-width
DrJKL 31b8178
fix: skip ResizeObserver updates for collapsed nodes
DrJKL 22f383e
docs: add release process guide (#9548)
christian-byrne 6b8ad37
fix: show load widget inputs in media dropdown (#9670)
DrJKL 68689d5
fix: add isGraphReady guard to prevent premature graph access error l…
jaeone94 1a6788d
Restore hiding of linked inputs in app mode (#9671)
AustinMroz cce5daa
fix: dispatch cloud build on synchronize for preview-labeled PRs (#9636)
huntcsg 7d603a5
Use preview downscaling in fewer places (#9678)
AustinMroz 9478582
fix: reduce vue drag sync fan-out and per-frame overhead
DrJKL 860f4b6
fix: skip no-op vue resize and slot sync work
DrJKL ff9e0e5
fix: simplify and harden vue resize no-op guards
DrJKL f06c9cd
fix: resolve coderabbit normalization and slot sync threads
DrJKL cd8e82b
Merge branch 'main' into drjkl/dark-energy
DrJKL 033dfe4
fix: reduce layout and ui scheduling overhead on interaction paths
DrJKL 48ba8b4
Merge branch 'main' into drjkl/dark-energy
DrJKL b86949b
Merge branch 'main' into drjkl/dark-energy
DrJKL b70eb1f
[automated] Apply ESLint and Oxfmt fixes
actions-user eefdebd
Merge branch 'main' into drjkl/dark-energy
DrJKL 516e012
types: We need to fix all the Parameters utility usages. That's silly
DrJKL f6b7f5c
Function Declarations and avoiding stale flushes
DrJKL afd9445
fix: address review feedback on layout normalization
DrJKL 8842d76
fix: address layout sync lint and node id lookup
DrJKL d157906
test: stabilize renderer toggle position assertions
DrJKL e5cc5db
Merge branch 'main' into drjkl/dark-energy
DrJKL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import { | ||
| comfyExpect as expect, | ||
| comfyPageFixture as test | ||
| } from '../fixtures/ComfyPage' | ||
| import type { ComfyPage } from '../fixtures/ComfyPage' | ||
| import type { Position } from '../fixtures/types' | ||
|
|
||
| type NodeSnapshot = { id: number } & Position | ||
|
|
||
| async function getAllNodePositions( | ||
| comfyPage: ComfyPage | ||
| ): Promise<NodeSnapshot[]> { | ||
| return comfyPage.page.evaluate(() => | ||
| window.app!.graph.nodes.map((n) => ({ | ||
| id: n.id as number, | ||
| x: n.pos[0], | ||
| y: n.pos[1] | ||
| })) | ||
| ) | ||
| } | ||
|
|
||
| async function getNodePosition( | ||
| comfyPage: ComfyPage, | ||
| nodeId: number | ||
| ): Promise<Position | undefined> { | ||
| return comfyPage.page.evaluate((targetNodeId) => { | ||
| const node = window.app!.graph.nodes.find((n) => n.id === targetNodeId) | ||
| if (!node) return | ||
|
|
||
| return { | ||
| x: node.pos[0], | ||
| y: node.pos[1] | ||
| } | ||
| }, nodeId) | ||
| } | ||
|
|
||
| async function expectNodePositionStable( | ||
| comfyPage: ComfyPage, | ||
| initial: NodeSnapshot, | ||
| mode: string | ||
| ) { | ||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const current = await getNodePosition(comfyPage, initial.id) | ||
| return current?.x ?? Number.NaN | ||
| }, | ||
| { message: `node ${initial.id} x drifted in ${mode} mode` } | ||
| ) | ||
| .toBeCloseTo(initial.x, 1) | ||
|
|
||
| await expect | ||
| .poll( | ||
| async () => { | ||
| const current = await getNodePosition(comfyPage, initial.id) | ||
| return current?.y ?? Number.NaN | ||
| }, | ||
| { message: `node ${initial.id} y drifted in ${mode} mode` } | ||
| ) | ||
| .toBeCloseTo(initial.y, 1) | ||
| } | ||
|
|
||
| async function setVueMode(comfyPage: ComfyPage, enabled: boolean) { | ||
| await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', enabled) | ||
| if (enabled) { | ||
| await comfyPage.vueNodes.waitForNodes() | ||
| } | ||
| await comfyPage.nextFrame() | ||
| } | ||
|
|
||
| test.describe( | ||
| 'Renderer toggle stability', | ||
| { tag: ['@node', '@canvas'] }, | ||
| () => { | ||
| test('node positions do not drift when toggling between Vue and LiteGraph renderers', async ({ | ||
| comfyPage | ||
| }) => { | ||
| const TOGGLE_COUNT = 5 | ||
|
|
||
| const initialPositions = await getAllNodePositions(comfyPage) | ||
| expect(initialPositions.length).toBeGreaterThan(0) | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| for (let i = 0; i < TOGGLE_COUNT; i++) { | ||
| await setVueMode(comfyPage, true) | ||
| for (const initial of initialPositions) { | ||
| await expectNodePositionStable( | ||
| comfyPage, | ||
| initial, | ||
| `Vue toggle ${i + 1}` | ||
| ) | ||
| } | ||
|
|
||
| await setVueMode(comfyPage, false) | ||
| for (const initial of initialPositions) { | ||
| await expectNodePositionStable( | ||
| comfyPage, | ||
| initial, | ||
| `LiteGraph toggle ${i + 1}` | ||
| ) | ||
| } | ||
| } | ||
| }) | ||
| } | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.