-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix theme proxy generation performance issue (#971)
* logging and prevent excessive theme changes * callback dependency * add await * Move if one layer up * remove `removeItem` * clear up useEffect * Revert "clear up useEffect" This reverts commit f5eddec. * Revert "remove `removeItem`" This reverts commit 11ab4b3. * Revert "Move if one layer up" This reverts commit cdc7e60. * Revert "add await" This reverts commit 55fd0a0. * Revert "callback dependency" This reverts commit 1ade218. * Revert "logging and prevent excessive theme changes" This reverts commit f10d982. * Remove zod parsing in creating values * Revert "Remove zod parsing in creating values" This reverts commit d6c0001. * Only use zod for validation, remove from proxy creation steps
- Loading branch information
1 parent
34c5fe7
commit 092e234
Showing
6 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { isObject } from "lodash"; | ||
import type { ThemeValues } from "./types"; | ||
|
||
export function isTextStyleObject(value: any): boolean { | ||
return Object.keys(value).some((key) => | ||
[ | ||
"fontFamily", | ||
"fontWeight", | ||
"fontSize", | ||
"fontStyle", | ||
"lineHeight", | ||
"letterSpacing", | ||
].includes(key) | ||
); | ||
} | ||
|
||
export function asThemeValuesObject(value: any): ThemeValues | null { | ||
// Any object that isn't a text style object is considered a ThemeValues object | ||
return !isTextStyleObject(value) && isObject(value) | ||
? (value as ThemeValues) | ||
: null; | ||
} |
This file contains 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
This file contains 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