Repository navigation
Conversation
Tchips46
left a comment
There was a problem hiding this comment.
Review: tutorial (54e3796)
Line numbers are at this PR's head.
Must fix
1. The tour keeps running after the project closes (apps/editor/src/routes/(editor)/project/[id]/+page.svelte:33-40, packages/ui/src/workbench/setup/setup-workbench.ts:194)
TourServicelives as long as the editor (setupShell), and the overlay belongs to each workbench. Nothing callstours.stop()when the workbench is disposed.- Example: start the tutorial, click the brand link, open
pong. The old bubble ("Add an entity") shows over pong, andadvanceWhenChanged: 'ecs.entityCount'compares pong's count with the tutorial's, so the tour jumps ahead on its own. A project plugin's tour also stays after that plugin unloads. - Trap: with Help › Tutorial from another project, the
?toureffect runs before the load effect's cleanup, so a plain "stop on dispose" stops the tour it just started. - Fix: start the tour inside the load effect, right after
workbench = created, withuntrack(() => page.url.searchParams.get('tour')). Callcreated?.tours.stop()in that effect's cleanup, and delete the separate$effect.
Should fix
2. Back bounces straight forward on auto-advancing steps (packages/ui/src/workbench/tour/tour-service.ts:70-72, 110, 126)
back()→_go(-1)→_check(), which advances as soon asadvanceWhenholds. From "Add an entity", Back goes to "scene", whosescreen == 'viewport.scene'is still true, so it returns at once. The same happens on the play and fix steps.- Fix: a
_manualflag set by Back and cleared by Next, with_checkreturning early while it is set. Add one test.
3. "Show Commit" throws when the folder is not a repository (apps/editor/src/lib/tutorial/tutorial-tour.const.ts:133-137, TourOverlay.svelte:118, tour-service.ts:82)
git.commithaswhen: "git.repository", but the step'swhenis onlyeditor.local. Skip Init, press Next, click "Show Commit":CommandPreconditionError, swallowed byvoid tours.act()as an unhandled rejection. The button does nothing.- Fix:
when: 'editor.local && git.repository', and catch errors inact()(notifyError).
4. createTutorial opens any my-first-game with a config, and two calls can race (packages/server-core/src/rpc/implementation/projects.implementation.ts:101-130)
- A user's own
nf new my-first-game, or a half-made folder from an interrupted run, opens as the tutorial, and the tour talks about files that don't exist. - Nothing stops a second call during the ~1 min
npm install, and no progress is shown. - Fix: treat the folder as the tutorial only when a tutorial file exists, and return CONFLICT otherwise. Keep one in-flight creation per name, and show progress in
startTutorial.
5. Turbo doesn't rebuild when tutorial files change (turbo.json:14-23, copy in apps/editor/scripts/build-server.ts:44)
tutorial/**is not in the buildinputs, so an edit there hits the cache and the old tutorial ships. Add"tutorial/**".
6. build-scene draws hitboxes as shapes (plugins/ecs/src/scene/build-scene.ts:89-90)
- The shape check runs per component, not per entity. Breakout's ball (
Box(18, 18)+Visual(new Rect({ cornerRadius: 9 }))) gets an extra square, and every brick is drawn twice, in the Scene screen and inGameMoveOverlay. - Fix: use the param guess only when the entity has no
Rect/Circlein any of its components.
7. E2E state left in account settings breaks the CI retry (apps/editor/src/lib/tutorial/Welcome.svelte:36, apps/editor/e2e/tips.spec.ts:16)
welcome.show = falseand the dismissed History tip are saved to the account, which outlives tests. On the CI retry (retries: 1), the welcome card and the tip are gone.- Fix: restore both in
afterEachand wait for "Account synced".
Nice to have
- Overlay z-index (
TourOverlay.svelte:136, 149):z-index: 2400is not a kit token and sits above dialogs, so a centered bubble covers an open Settings dialog. Use a token and document it in the z-order. - Repeated tour id (
apps/editor/src/routes/(editor)/+page.svelte:105):?tour=tutorialrepeatsTUTORIAL_TOUR_ID; use the constant.
4cb1539 to
789e4ec
Compare
- the tour starts and stops with its project's workbench - back stays on a step whose condition already holds - the commit step needs a repository, failed tour actions are shown - one tutorial project at a time, an existing folder is reused only when it is the tutorial's - the scene draws an entity with a Rect or Circle once - turbo rebuilds the editor when tutorial files change - the tour overlay has its own layer below dialogs - e2e: the tutorial and tips specs put account settings back
789e4ec to
5b36894
Compare
What does this PR do?
Add tutorial to the app
How do you test this PR?