Repository navigation
[fix] canvas: leave the example dialog once the import finishes - #500
Open
Zhangbo-cn wants to merge 7 commits into
Open
Zhangbo-cn wants to merge 7 commits into
Zhangbo-cn wants to merge 7 commits into
Conversation
Zhangbo-cn
requested review from
hsliuustc0106 and
princepride
as code owners
November 25, 2026 03:03
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
force-pushed
the
fix/example-import-autoclose
branch
from
November 25, 2026 03:56
d714b79 to
a7ca0e0
Compare
Collaborator
|
PASS a7ca0e0
Nit, not blocking: with several entries, any single entry reaching Ran: |
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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. Thedonestate 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 ordone, and at least onedone— 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 on92e79bf5(after), in English and Chinese. The branch was then merged withmainat42c5dc39; the two files this PR changes are byte-identical between92e79bf5and the merged headc293b42e(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.After (head): the dialog closes by itself and the imported two-node canvas is immediately visible.
Playable recordings (the transition a screenshot cannot show):
728b4077), Chinese: MP4 — the same import, with the dialog still open at the end.Failing before, passing after: the updated test file was copied onto
728b4077and run there.728b4077is an ancestor of the reviewed base42c5dc39, and both files this PR changes have the same blob IDs at the two commits —3293fcf2forExampleCanvasDialog.tsxand435d2577forexample_canvas_picker.mjs— so this run exercises exactly the dialog code of the reviewed base:On the head the same file passes with no output (
node tests/browser/example_canvas_picker.mjs), and Release checks at the pushed head reportPASS 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— passednpm test— 1114 passed, 0 failednpm run check:i18n— 3857 keys, 0 problems, 170 Chinese source lines (baseline 170)npm run check:browser-locale— 101 pages, 0 problems, 112 scriptsnpm run check:browser-manifest— 111 entries, gate=38c293b42eby 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, andchecks / checks. The isolated lane reportsPASS 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-CNanden-US; the recordings show the same imported nodes and the same auto-close in both languages.Review
42c5dc3926026384c13f7a6cc633792df44d079d(origin/main)c293b42e10d0e6ec0d2aca2a9db15bdfe05a2fcfopendirector-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.47434199575passed 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 the728b4077↔42c5dc39byte 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.728b4077and the after captures at92e79bf5, 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