Collapse the button-variant fork and the canvas's duplicate work
LoadingButton kept its own copy of buttonVariants, which had drifted past `brand` and the icon sizes; it imports Button's now, so the Connect / Re-pair button can show the loader instead of swapping its own label. DashboardView mounted a second LookProvider inside the one CanvasSurface already gives it and dropped `touch` on the way, so every widget on a touch panel read `useLook().touch` as false. The provider is now mounted once, by whatever owns the canvas root. useCanvasRoot resolved the palette twice per render — once for the theme class, once for the tokens — so useDashboardTheme takes the roles the caller already has. The bar assertions in widgets.spec.ts are scoped to the Load tile rather than the page, which held only because the unbound spare bar draws no rows. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VfgHWr7AQDiLsTQVu7hpKB
This commit is contained in:
@@ -146,12 +146,16 @@ export function useDashboardBackground(
|
||||
* whether the surface is light or dark is a fact about the palette rather than
|
||||
* a second setting that could disagree with it. The class still goes on,
|
||||
* because a chart canvas and the shadcn pieces inside the tile read it.
|
||||
*
|
||||
* The roles are passed in rather than resolved here: the caller needs them for
|
||||
* the tokens anyway, and reading them twice subscribes to the palette's
|
||||
* message twice.
|
||||
*/
|
||||
export function useDashboardTheme(
|
||||
dashboard: DashboardDef_Output | undefined,
|
||||
roles: Roles | null,
|
||||
): "" | "light" | "dark" {
|
||||
const value = useSetting(dashboard, "theme")
|
||||
const roles = rolesOf(useDashboardPalette(dashboard))
|
||||
if (roles) return isLight(roles.background) ? "light" : "dark"
|
||||
return value === "dark" || value === "light" ? value : ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user