fix(_app): call createGui with empty themes/tokens to satisfy components

@luxfi/ui components (Badge, Button, Tooltip, etc.) call @hanzogui's
getConfig() at module init and throw "Err0" when no config exists.
The previous commit removed the createGui call to avoid an Object.keys
crash on undefined themes, but that broke component loading instead.

createGui crashes when configIn.themes is undefined (Object.keys(undefined)
in getThemesDeduped). Passing themes: {} routes through scanAllSheets
which returns safely. tokens: {} matches the noTokens guard at line 27.

Net effect: createGui completes, globalThis.__guiConfig is populated,
and downstream @hanzogui/* components find a non-null config.
This commit is contained in:
2026-06-10 14:36:12 -07:00
parent 5528b87c4b
commit 247cdf7b83
+12
View File
@@ -1,9 +1,21 @@
import { createGui } from '@hanzogui/core';
import { Toaster } from '@luxfi/ui/toaster';
import { QueryClientProvider } from '@tanstack/react-query';
import type { AppProps } from 'next/app';
import dynamic from 'next/dynamic';
import React from 'react';
// Initialize @hanzogui once at module scope (client side only).
// We supply explicit empty themes/tokens to dodge the upstream crash
// where createGui calls Object.keys(undefined) when configIn.themes is
// missing (see @hanzogui/web createGui → getThemesDeduped). Components
// from @luxfi/ui still need getConfig() to return a non-null config or
// they throw "Err0" at module load.
if (typeof window !== 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createGui({ themes: {}, tokens: {}, settings: { autocompleteSpecificTokens: 'except-special' } } as any);
}
import type { NextPageWithLayout } from 'nextjs/types';
import type { Route } from 'nextjs-routes';