Repository navigation
main.js only wires: eight startup blocks move into their own modules (part of #683) - #1004
Conversation
#683) main.js goes from 900 to 559 lines; the budget drops to 580. Folder pools, demo folder lists, scan workers, nav tabs, the close guard, the hl.exe path watchers, the queue footer and the app shortcuts each get a module wired in with one call. No behaviour change. Adds app-boot.spec.js, the first e2e spec that boots the real index.html + main.js, and a CLAUDE.md line: the budget is a backstop, not the target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of dfff4f4 (diff against Diff review: every moved block compared line by line with dev's main.js. All state reads still go through getters (
Live check (
An older issue, not from this PR: the Explorer's Recent list doesn't redraw when + Add Folder records a visit. The new folder is saved, but the list stays out of date until something else redraws it. Dev's No changes pushed. As far as I can tell this changes no behaviour and is ready to merge. |
…ast demo by full path - initDemoCache returned nothing when the Cache all button exists (the real app), so analyzer_pane's destructure threw and the rest of initAnalyzerPane never ran. app-boot.spec.js (from #1004) caught it. - demo_cache_progress's `last` was a bare file name, so the player read's `paths.includes(last)` never matched and players only filled in when Cache all ended. It is now the full path given (nothing else reads it). - CloudCheck looks a folder's volume up once, not once per demo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Release note: none
Part of #683 (closed; this is the second pass it asked for).
studio/src/main.jsgoes from 900 → 559 lines.main_js_budget.test.js's BUDGET drops from 900 to 580 (559 + ~20 headroom). Each block below was a feature's init, listeners and the state only it needs; each now lives in its own module and main.js wires it with one call, the wayopen_from_explorer.jsdid. Boot order is unchanged: every call sits where its block used to be.What moved where
folder_pools.jscreateFolderPools({ getDemos, persist, refreshSetup })initAnalyzerPanedemo_folders.jscreateDemoFolders({ persist }), later.startAnalyzerPane()scan_workers.jsstartScanWorkers({ persist })(+readScanWorkersimport)nav_tabs.jsstartNavTabs()close_guard.jsstartCloseGuard({ needsSavePrompt, requestUnsavedChangesConfirmation, persistAppSettings })hl_path_watch.jsstartHlPathWatch({ renderQueue })(+readHlPath, used for three getters main had inline)queue_footer.jsrenderQueueFooter(demos)insideupdateDemoFooterapp_shortcuts.jsstartAppShortcuts()main.js keeps the queue state and the functions that reassign it (
replaceScannedDemos,onDeleteDemo,selectDemoAndRenderDetail), the factories' wiring, and the boot order. Two stale comments incapture_pane.jsthat named main.js'supdateExportPoolIndicator/targetDrivesnow point at the new modules.CLAUDE.md: one sentence added to the "
studio/src/main.jsonly wires" bullet (asked for by the user): the budget is a backstop, not the target; build a feature outside main.js from its first line and wire it in with one call.New test
tests/e2e/app-boot.spec.jsis the first e2e spec that boots the realindex.html+main.js(every other spec loads its own pane harness, so none of them ran main.js). With mocked settings it checks: the capture/render folder lists and free-space line fill in, the scan-workers hint shows the memory, Add puts a typed folder in the list and the save carries it along with the pinned folder, the reload/session shortcuts and context menu are swallowed, and boot throws noReferenceError/"is not a function" (the shape a wiring slip takes). Panes whose boot IPC the mock doesn't answer still throw onundefinedat boot; those 5 errors are the same on dev, so the spec ignores them. README intests/e2e/notes the exception.Test done
npm run test:unit: 851 passed (budget test included, at 559/580).CI=1 npx playwright test(full suite): 390 passed (388 existing + 2 new).npm run build: exit 0.app-boot.spec.jsagainst dev's original main.js swapped in. Same functional results and the same 5 unmocked-IPC boot errors as the new main.js.onCloseRequested.Decisions
createFolderPoolsruns, a few lines before the settingsawaitrather than after it. That only matters for a click in the instant before settings load, and the list rows' own Browse buttons were already live then.app_shortcuts.jsreads(e.key || '').toLowerCase()once, where the old code callede.key.toLowerCase()only behind the Ctrl check. That keeps it from throwing on Chromium autofill keydowns that carry no key. Same results for every real key.analyzer_pane.js(Demo Analyzer: players of a folder read before show at once, and cloud demos aren't downloaded to list them (#992) #996) andindex.html(Render tab: Select finished ticks every take whose clips are done, to clear leftover takes in one go (part of #644) #997). They're still accurate in spirit (the state is owned outside the pane), just not by file name.🤖 Generated with Claude Code