Skip to content

Commit

Permalink
docs(website): correct theme color blink when playground is initializ…
Browse files Browse the repository at this point in the history
…ed (#4870)
  • Loading branch information
armano2 committed Apr 26, 2022
1 parent f3cf87b commit acb5310
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/website/src/components/editor/useSandboxServices.ts
Expand Up @@ -10,6 +10,7 @@ import type {

import { sandboxSingleton } from './loadSandbox';
import { editorEmbedId } from './EditorEmbed';
import { useColorMode } from '@docusaurus/theme-common';

export interface SandboxServicesProps {
readonly jsx?: boolean;
Expand All @@ -34,6 +35,7 @@ export const useSandboxServices = (
): Error | SandboxServices | undefined => {
const [services, setServices] = useState<Error | SandboxServices>();
const [loadedTs, setLoadedTs] = useState<string>(props.ts);
const { isDarkTheme } = useColorMode();

useEffect(() => {
if (props.ts !== loadedTs) {
Expand Down Expand Up @@ -74,6 +76,9 @@ export const useSandboxServices = (
main,
ts,
);
sandboxInstance.monaco.editor.setTheme(
isDarkTheme ? 'vs-dark' : 'vs-light',
);

const libMap = await sandboxInstance.tsvfs.createDefaultMapFromCDN(
sandboxInstance.getCompilerOptions(),
Expand Down

0 comments on commit acb5310

Please sign in to comment.