Skip to content

Commit 8fdd63d

Browse files
committed
fix: bug where scoped styles that were numbers would return NaN
1 parent 194f396 commit 8fdd63d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/core/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function useUI<T extends string = string>(key: string, initialValue: T): [T, UIS
8585
const value = target.dataset[camelKey] as T;
8686

8787
// Call the updater function with the parsed current value
88-
newValue = valueOrUpdater(value);
88+
newValue = valueOrUpdater(value ?? initialValue);
8989
} else {
9090
// Direct value assignment (no updater function)
9191
newValue = valueOrUpdater;
@@ -114,7 +114,7 @@ function useUI<T extends string = string>(key: string, initialValue: T): [T, UIS
114114
`[useUI] Multiple ref attachments detected for key "${key}". ` +
115115
`Each useUI hook supports only one ref attachment per component. ` +
116116
`Solution: Create separate component. and reuse.\n` +
117-
`Example: <FAQ/> <FAQ/> instead of multiple refs in one component.`
117+
`Example: <FAQ/> <FAQ/> instead of multiple refs in one component.`
118118
);
119119
}
120120
} else {

packages/core/src/postcss/index.cts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const plugin: PluginCreator<void> = () => {
1616
async Once(root: Root, { result }) {
1717
try {
1818
/* ── generate + inject variants ─────────────────────────── */
19+
/*
20+
finalVariants: VariantData[] // = { key: string; values: string[]; initialValue: string | null;}
21+
initialValues: Record<string, string>; // key: initialValue
22+
sourceFiles: string[]; // file paths (absolute)
23+
*/
1924
const { finalVariants, initialValues, sourceFiles } = await processVariants();
2025

2126
const cssBlock = buildCss(finalVariants);

0 commit comments

Comments
 (0)