Set theme initially so that the gneerated JS code knows the correct theme already (#3193)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Hariom Balhara 2022-06-29 18:50:46 +00:00 committed by GitHub
parent 4a74abcb34
commit fbc4eb5457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ export default function useTheme(theme?: Maybe<string>) {
const embedTheme = useEmbedTheme();
// Embed UI configuration takes more precedence over App Configuration
theme = embedTheme || theme;
const [_theme, setTheme] = useState<Maybe<string>>(null);
const [_theme, setTheme] = useState<Maybe<string>>(theme);
useEffect(() => {
// TODO: isReady doesn't seem required now. This is also impacting PSI Score for pages which are using isReady.
setIsReady(true);