fix(dashboard): fix buddy dev --dashboard white screen (sidebar ENOENT + Craft HTTPS cert)#2191
Merged
Merged
Conversation
…creening `buddy dev --dashboard` rendered a blank/white window because the global dashboard layout resolved `<Sidebar>` from @stacksjs/components, and 0.2.9x stopped shipping tag-resolvable .stx sources (only hashed dist/ output). The component no longer resolved, the stx plugin fell back to a filesystem search, and every dashboard page fatal-errored with "ENOENT ... open 'sidebar'" (#1989). In the native Craft window that surfaced as a white screen. Render the sidebar from the framework's own buildSidebarChunks() HTML inside a plain <aside data-stx-sidebar>, styled with plain CSS in the layout's leading <style> block (stx serves raw layout CSS verbatim but does not expand @apply there). This drops the dependency on the external component for core nav chrome, so the dashboard renders regardless of which @stacksjs/components version is installed. Role gating still works via the data-required-roles the markup emits; section collapse, SPA nav, and active highlight are wired against the .sidebar-link markup. Refs #1989
… pretty URL
Craft's WKWebView rejects the tlsx local-CA cert ("The certificate for this
server is invalid") because Craft installs no didReceiveAuthenticationChallenge
handler, so opening https://dashboard.stacks.localhost fails the provisional
navigation and the window stays blank / flashes then clears. Verified directly:
a WKWebView snapshot over the https URL fails with that error, while the same
webview renders the dashboard perfectly over http://localhost (both normal and
the window's transparent titlebarHidden mode).
Point the native window at the http localhost origin, which needs no cert. The
browser-facing "Local" URL stays https for anyone opening it in a real browser.
Refs #1989 #2191
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.
./buddy dev --dashboardopened a white / "flash then goes away" Craft window. It was two independent bugs; both needed fixing.Bug 1 -
<Sidebar>ENOENT (content)The global dashboard layout resolved
<Sidebar>from@stacksjs/components, but 0.2.9x stopped shipping tag-resolvable.stxsources (only hasheddist/output; its ownstx-plugin.tspoints at an unpublished./src/ui). So<Sidebar>couldn't resolve, the stx plugin fell back to a filesystem search, and every dashboard page fatal-errored withENOENT ... open 'sidebar'(#1989).Fix: render the sidebar from the framework's own
buildSidebarChunks()HTML inside a plain<aside data-stx-sidebar>, styled with plain CSS in the layout. No dependency on the external component - the dashboard renders regardless of which@stacksjs/componentsversion is installed. Role gating, section collapse, SPA nav, and active-highlight are wired to the new markup.Bug 2 - Craft's WKWebView rejects the HTTPS cert (the actual white screen)
The native window opened the HTTPS pretty URL (
https://dashboard.stacks.localhost). Craft's WKWebView rejects the tlsx local-CA cert:Craft installs no
didReceiveAuthenticationChallengehandler, so it does not honor the local-CA trust (even though the CA is in the keychain). The provisional navigation fails and the window stays blank / flashes then clears.Fix: point the native window at
http://localhost:<port>(nativeWindowUrlindev/dashboard.ts). Loopback HTTP needs no cert; the browser-facing "Local" URL stays HTTPS for anyone opening it in a real browser.How it was verified
A standalone
swift+WKWebView+takeSnapshotharness reproduces Craft's exact engine headlessly (headless Chromium does not catch WKWebView TLS/JS issues):certificate is invalid(reproduces the white screen).titlebarHiddenmode./and/commerce/productsboth render fully (sidebar + content); noError loading component; lint clean.Follow-up (Craft repo, optional)
Craft could add a
didReceiveAuthenticationChallengehandler to trust the local dev CA, which would let the native window use HTTPS too. Not required for this fix.Refs #1989