Skip to content

[fix] canvas: leave the example dialog once the import finishes - #500

Open
Zhangbo-cn wants to merge 7 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/example-import-autoclose
Open

Zhangbo-cn wants to merge 7 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/example-import-autoclose

Conversation

@Zhangbo-cn

@Zhangbo-cn Zhangbo-cn commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Importing an example canvas from the picker created the nodes but left the picker on top of them, with every row reporting that it had finished. Reaching the imported canvas needed a second click on Close, even though there was nothing left to decide in the dialog.

The dialog now leaves on its own 600 ms after an import reports done — long enough to read the completion line, short enough that nobody reaches for the close button. The timer is cancelled if the dialog unmounts.

The close condition also waits for every row to settle: a row that is still downloading, importing, or failed keeps the dialog open, so a second import is not orphaned mid-download and an error stays on screen instead of disappearing with the dialog. This settle path is code-reviewed only: the browser test covers a single import that reaches done, and no test or artifact exercises a second row blocking auto-close. The done state stays readable for that 600 ms; the existing Close controls remain usable until then.

Changes

  • src/canvas/workspace/example/ExampleCanvasDialog.tsx: derive whether the imports have settled — every row idle or done, and at least one done — and close 600 ms after that point, holding the close callback in a ref so a parent re-render cannot restart the timer.
  • tests/browser/example_canvas_picker.mjs: the picker journey now imports through the dialog and asserts the dialog becomes hidden, both from the empty canvas and from the project menu. The old step that clicked Close after a finished import is replaced by the same assertion, because that click no longer exists in the flow.

Linked issue

No issue is linked; the scope is the dialog behaviour described above.

Evidence

Steps: an isolated fixture API and Vite served a project with an empty canvas. A route answered the image example's download with a two-node fixture archive after a 900 ms delay, so the progress state is visible. The browser opened the canvas, pressed Browse example canvases, pressed Download and import, and the recording continued until the dialog closed and the imported nodes were visible. The same flow was captured on 728b4077 (before) and on 92e79bf5 (after), in English and Chinese. The branch was then merged with main at 42c5dc39; the two files this PR changes are byte-identical between 92e79bf5 and the merged head c293b42e (git diff 92e79bf5 c293b42e -- <the two files> is empty), so the captures below show the code under review.

Before (728b4077): the import finishes, the row reads 已导入「图像创作示例画布」 with a 关闭 button, and the dialog stays open over the imported canvas.

Before, Chinese: the finished import leaves the dialog open (728b4077)

Before, English: the finished import leaves the dialog open (728b4077)

After (head): the dialog closes by itself and the imported two-node canvas is immediately visible.

After, Chinese: the dialog is gone and the imported canvas is visible (92e79bf5)

After, English: the dialog is gone and the imported canvas is visible (92e79bf5)

Playable recordings (the transition a screenshot cannot show):

  • Chinese, head: MP4
  • English, head: MP4
  • Before (728b4077), Chinese: MP4 — the same import, with the dialog still open at the end.

After, Chinese: recording of the import progress, the completion line, and the dialog closing (92e79bf5)

After, English: recording of the import progress, the completion line, and the dialog closing (92e79bf5)

Failing before, passing after: the updated test file was copied onto 728b4077 and run there. 728b4077 is an ancestor of the reviewed base 42c5dc39, and both files this PR changes have the same blob IDs at the two commits — 3293fcf2 for ExampleCanvasDialog.tsx and 435d2577 for example_canvas_picker.mjs — so this run exercises exactly the dialog code of the reviewed base:

BASE SHA: 728b40774628307f315a2b29c466237a8c434a11
$ node tests/browser/example_canvas_picker.mjs
locator.waitFor: Timeout 15000ms exceeded.
Call log:
  - waiting for locator('.cw-example-dialog') to be hidden
  24 × locator resolved to visible <dialog open="" class="cw-example-dialog" ...>
    at /tmp/od500-base/tests/browser/example_canvas_picker.mjs:104:16

On the head the same file passes with no output (node tests/browser/example_canvas_picker.mjs), and Release checks at the pushed head report PASS example canvas picker (11.7s) in the isolated lane.

The fixture archive is a generated two-node canvas with no media, served by the test route; no real provider or remote example download was used.

Test plan

Local, on the merged head (c293b42e):

  • node_modules/.bin/tsc --noEmit — passed
  • npm test — 1114 passed, 0 failed
  • npm run check:i18n — 3857 keys, 0 problems, 170 Chinese source lines (baseline 170)
  • npm run check:browser-locale — 101 pages, 0 problems, 112 scripts
  • npm run check:browser-manifest — 111 entries, gate=38
  • Before/after screenshots and recordings captured in both languages (above)
  • The same picker test is exercised at c293b42e by Release checks, where it passes (11.7 s)

Release checks

Run 47434199575 at c293b42e: every lane passed — checks / static, checks / frontend, checks / browser (assistant), checks / browser (isolated), checks / browser (voice), checks / desktop / windows, checks / desktop / macos, the three python shards, checks / python-native, and checks / checks. The isolated lane reports PASS example canvas picker (11.7s).

Bilingual UI

No message key or user-facing string changed. The completion line and both dialog controls already existed in zh-CN and en-US; the recordings show the same imported nodes and the same auto-close in both languages.

Review

  • Reviewed base: 42c5dc3926026384c13f7a6cc633792df44d079d (origin/main)
  • Reviewed head: c293b42e10d0e6ec0d2aca2a9db15bdfe05a2fcf
  • Self-review (opendirector-review, candidate mode): 93/100, PASS. Ratings: scope 3/3, correctness 3/3, validation 2/3, claim evidence 3/3, simplicity 3/3. The validation deduction is that the multi-row settle path and the failed-row-keeps-open path are code-review-only; the single-import auto-close path is covered by the browser test.
  • Independent candidate review (non-contributing subagent, same skill and pinned base/head): 93/100, PASS, same ratings (scope 3/3, correctness 3/3, validation 2/3, claim evidence 3/3, simplicity 3/3). It checked the diff against every body claim, confirmed all nine evidence URLs resolve, the changed files are byte-identical on both sides of the captures, and run 47434199575 passed 12/12 jobs with the isolated lane logging the example picker test. Its findings were body-only and are fixed here: the Changes bullet described the timer as starting at the first completed import although the code waits for every row to settle, and the failing-before section did not state the 728b4077 ↔ 42c5dc39 byte identity of the changed files. It confirmed the disclosed settle-path gap and noted that the English before screenshot shows the Chinese example name, which is pre-existing and untouched by this diff.
  • Material validation gaps: the multi-row settle behaviour and the failed-row path are code-review-only; the before captures were taken at 728b4077 and the after captures at 92e79bf5, with the two changed files byte-identical to the reviewed base and head respectively; the example archive is a fixture served by the test route, with no real provider or remote download.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation type:bug Something is broken labels Nov 25, 2026
Importing an example ended with the dialog still on screen, every entry marked done, and the newly created project waiting behind it. The import had already opened the example, so the only thing left to do in that dialog was to close it by hand.

The dialog now closes itself half a second after an import reports done, which is long enough to read the completion line. The close callback is held in a ref so a parent re-render does not restart the timer, and the timer is cleared on unmount and when the done state goes away.
@Zhangbo-cn
Zhangbo-cn force-pushed the fix/example-import-autoclose branch from d714b79 to a7ca0e0 Compare November 25, 2026 03:56
@kunkunblueberry

Copy link
Copy Markdown
Collaborator

PASS a7ca0e0

  • The dialog closes itself 600 ms after an import reports done. closeRef keeps a parent re-render from restarting the timer, and the effect clears the timer on unmount or when done goes away.
  • The browser test is the part that matters: it previously passed with the dialog still on screen, which was exactly the reported defect. It now imports through the picker, waits for the dialog to be hidden and asserts the two nodes exist. That is a check that fails on the old behaviour.

Nit, not blocking: with several entries, any single entry reaching done closes the dialog, so a user importing a second example loses the picker mid-way.

Ran: gh pr checks 500 on a7ca0e0 (13/13); read the full diff of both files.
Not run: the browser lane locally.

Zhangbo-cn and others added 6 commits December 2, 2026 22:18
capability discovery / the real-OpenCode worker timed out under load; both pass
locally on this tree.
A successful import left the picker covering the canvas it had just
created. The dialog now leaves 600 ms after an import reports done, and
it waits for every row to settle so a second running download is not
orphaned and a failure stays visible.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants