Skip to content

Commit

Permalink
Fix concurrent issue when loading the wasm file -- we only want to lo…
Browse files Browse the repository at this point in the history
…ad it once
  • Loading branch information
NullVoxPopuli committed Nov 7, 2023
1 parent 50c1c76 commit 73ae37c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ember-repl/addon/src/browser/gjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ const compiler = importSync('ember-source/dist/ember-template-compiler.js');
import { createPreprocessor } from 'content-tag/standalone';

let processor;
let fetchingPromise: Promise<any>;

export async function preprocess(input: string, name: string): Promise<string> {
processor ||= await createPreprocessor();
if (!fetchingPromise) {
fetchingPromise = createPreprocessor();
}

processor = await fetchingPromise;

return processor.process(input, `${name}.js`);
}
Expand Down

0 comments on commit 73ae37c

Please sign in to comment.