Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): avoid concurrent compile step and init #946

Merged
merged 4 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(client): add status updating and disable autorunning
  • Loading branch information
danilowoz committed May 26, 2023
commit adb19b2e2e24fbb88eea6f3a9cd94a830e590be9
3 changes: 3 additions & 0 deletions sandpack-client/src/clients/static/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export class SandpackStatic extends SandpackClient {
) {
super(selector, sandboxSetup, options);

this.status = "initializing";

this.emitter = new EventEmitter();
this.previewController = new PreviewController({
baseUrl:
Expand Down Expand Up @@ -160,6 +162,7 @@ export class SandpackStatic extends SandpackClient {
const previewUrl = await this.previewController.initPreview();
this.iframe.setAttribute("src", previewUrl);

this.status = "done";
this.dispatch({ type: "done", compilatonError: false });
this.dispatch({
type: "urlchange",
Expand Down
2 changes: 1 addition & 1 deletion sandpack-react/src/Issues.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function App() {
>
2
</button>
<SandpackProvider template="vite-react">
<SandpackProvider options={{ autorun: false }} template="react">
<SandpackLayout>
<SandpackLog />
<SandpackCodeEditor />
Expand Down