Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Jul 19, 2024
1 parent e73dd62 commit 77a5abe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export default withDocsInfra({
),
'@toolpad/utils': path.resolve(currentDirectory, '../packages/toolpad-utils/src'),
'@toolpad/core': path.resolve(currentDirectory, '../packages/toolpad-core/src'),
'create-toolpad-app': path.resolve(
currentDirectory,
'../packages/create-toolpad-app/src/api.ts',
),
},
},
module: {
Expand Down
19 changes: 9 additions & 10 deletions docs/pages/toolpad/builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ export default function Builder() {
throw new Error('Frame not found');
}

if (webcontainerPromiseRef.current) {
return;
}

const frame = frameRef.current;

const webcontainerPromise = webcontainerPromiseRef.current ?? WebContainer.boot();
const webcontainerPromise = Promise.resolve(webcontainerPromiseRef.current).then(
async (maybeInstance) => {
if (maybeInstance) {
await maybeInstance.teardown();
}
return WebContainer.boot();
},
);

webcontainerPromiseRef.current = webcontainerPromise;

webcontainerPromise.then(async (instance) => {
Expand Down Expand Up @@ -87,11 +91,6 @@ export default function Builder() {
frame.src = `${url}/page`;
});
});

// eslint-disable-next-line consistent-return
return () => {
// webcontainerPromise.then((instance) => instance.teardown());
};
}, []);

const [loading, setLoading] = React.useState(true);
Expand Down

0 comments on commit 77a5abe

Please sign in to comment.