Skip to content

Commit cb6502b

Browse files
committed
Create generatorContext earlier, before blockly workspaces are setup.
1 parent a554185 commit cb6502b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
171171
const [languageInitialized, setLanguageInitialized] = React.useState(false);
172172
const [themeInitialized, setThemeInitialized] = React.useState(false);
173173

174-
const blocksEditor = React.useRef<editor.Editor | null>(null);
175174
const generatorContext = React.useRef<GeneratorContext | null>(null);
175+
176+
const blocksEditor = React.useRef<editor.Editor | null>(null);
176177
const blocklyComponent = React.useRef<BlocklyComponentType | null>(null);
177178

178179
/** Initialize language from UserSettings when app first starts. */
@@ -411,6 +412,7 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
411412
// Initialize blocks when app loads
412413
React.useEffect(() => {
413414
initializeBlocks();
415+
generatorContext.current = createGeneratorContext();
414416
}, []);
415417

416418
React.useEffect(() => {
@@ -442,8 +444,6 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
442444

443445
registerToolboxButton(newWorkspace, messageApi);
444446

445-
generatorContext.current = createGeneratorContext();
446-
447447
if (currentModule) {
448448
generatorContext.current.setModule(currentModule);
449449
}

0 commit comments

Comments
 (0)