Repository navigation
feat(gui): model browser preview as a first-class state - #255
Merged
Merged
Conversation
The backend-less browser preview leaked raw "Cannot read properties of undefined (reading 'invoke')" TypeErrors and rendered an error-toned status dot, treating an expected dev state as a failure. - Add invokeBackend() in lib/tauri.ts: in the browser preview it rejects with a clear, actionable message (BROWSER_PREVIEW_MESSAGE) instead of letting invoke throw a raw TypeError. Route the compute sidecar (apiClient), serial bridge (marlin-api), and file bridge (commands) through it. backend-health reuses the shared message constant. - Skip the auto port-probe on Machine-tab entry when there is no backend, so the preview no longer surfaces an unsolicited error toast + log line on entry. - Give the status-bar dot its own "preview" treatment (info blue via --status-info-fg) instead of reusing the red "unavailable" status, matching the info-tone banner. Rename the stale cliText -> backendText. - Move components/machine/BackendHealthWarning.svelte to shell/BackendStatusBanner.svelte (it is app-scoped and covers both the info and warning states, not machine-only) and rename accordingly. - Default __TAURI_INTERNALS__ in the test setup so isTauri()/invokeBackend resolve true by default (the app's primary runtime); the backend-health suite still manages the global itself for its browser-preview path. User-initiated backend actions now show the clear message; auto actions stay silent. Part of #246. Closes #249.
Closed
6 tasks
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.
Closes #249. Part of epic #246 (post-redesign audit follow-ups).
Problem
The backend-less browser preview wasn't modeled as its own state — it leaked raw runtime errors and rendered inconsistent signals:
Cannot read properties of undefined (reading 'invoke')via toast + inline state + log.components/machine/though app-scoped; stalecliTextidentifier.Fix
invokeBackend()(new,lib/tauri.ts): in the preview it rejects with a clear, actionableBROWSER_PREVIEW_MESSAGEinstead of lettinginvokethrow a raw TypeError. Compute sidecar (apiClient), serial bridge (marlin-api), and file bridge (commands) all route through it;backend-healthreuses the shared constant.previewtreatment (info blue) instead of reusing redunavailable.cliText→backendText.components/machine/BackendHealthWarning.svelte→shell/BackendStatusBanner.svelte(app-scoped, covers info + warning).__TAURI_INTERNALS__soisTauri()resolves true by default (the app's primary runtime); thebackend-healthsuite still manages the global for its preview-path test.Verification
lint:css,lint:css:vars,check:svelte(0 errors),tsc, 316/316 tests ✓npm run tauri dev…" in toast + log; status dot is blue. Screenshots confirm.