understanding

This commit is contained in:
2026-02-06 16:29:09 -05:00
parent bfea6816ef
commit 1cee931913
13 changed files with 161 additions and 398 deletions

View File

@@ -93,9 +93,6 @@ type ThemeResolved = {
* This ensures children are NOT rendered until the theme is ready,
* preventing "useTheme must be used within a ThemeProvider" errors.
*
* The key insight from opencode's implementation is that the provider
* uses `<Show when={ready}>` to gate rendering, so components can
* safely call useTheme() without checking ready state.
*/
export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
name: "Theme",
@@ -121,8 +118,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
);
})
.catch(() => {
// If custom themes fail to load, fall back to opencode theme
setStore("active", "opencode");
setStore("active", "catppuccin");
})
.finally(() => {
// Only set ready if not waiting for system theme
@@ -206,7 +202,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
if (store.active === "system") {
setStore(
produce((draft) => {
draft.active = "opencode";
draft.active = "catppuccin";
draft.ready = true;
}),
);