Skip to content

Commit

Permalink
fix(timeout): clear it when there is a syntax error (#1087)
Browse files Browse the repository at this point in the history
* fix(timeout): clear it when there is a syntax error

* feat: Fix Playground component name to EslintBasic, add ESLint configuration rules and dev dependencies and update project template
  • Loading branch information
danilowoz committed Feb 23, 2024
1 parent 650baac commit 6777c24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions sandpack-react/src/contexts/utils/useClient.ts
Expand Up @@ -349,6 +349,10 @@ export const useClient: UseClient = (

setState((prev) => ({ ...prev, error: null }));
} else if (msg.type === "action" && msg.action === "show-error") {
if (timeoutHook.current) {
clearTimeout(timeoutHook.current);
}

setState((prev) => ({ ...prev, error: extractErrorDetails(msg) }));
} else if (
msg.type === "action" &&
Expand Down
4 changes: 2 additions & 2 deletions sandpack-react/src/presets/Sandpack.stories.tsx
Expand Up @@ -268,7 +268,7 @@ export const FileResolver = (): JSX.Element => {
}}
files={defaultFiles}
options={{
bundlerURL: "https://1ad528b9.sandpack-bundler.pages.dev",
bundlerURL: "https://sandpack-bundler.codesandbox.io",
fileResolver: {
isFile: async (fileName): Promise<boolean> =>
new Promise((resolve) => resolve(!!filesA[fileName])),
Expand All @@ -285,7 +285,7 @@ export const FileResolver = (): JSX.Element => {
}}
files={defaultFiles}
options={{
bundlerURL: "https://1ad528b9.sandpack-bundler.pages.dev",
bundlerURL: "https://sandpack-bundler.codesandbox.io",
fileResolver: {
isFile: async (fileName): Promise<boolean> =>
new Promise((resolve) => resolve(!!filesB[fileName])),
Expand Down
6 changes: 3 additions & 3 deletions website/docs/src/pages/advanced-usage/bundlers.mdx
Expand Up @@ -27,7 +27,7 @@ You just need to set the new bundler URL in your Sandpack instance:
```jsx
<SandpackProvider
template="react"
options={{ bundlerURL: "https://sandpack-bundler.pages.dev" }}
options={{ bundlerURL: "https://sandpack-bundler.codesandbox.io" }}
>
{/* Children */}
</SandpackProvider>
Expand All @@ -38,7 +38,7 @@ You just need to set the new bundler URL in your Sandpack instance:
```jsx
<Sandpack
template="react"
options={{ bundlerURL: "https://sandpack-bundler.pages.dev" }}
options={{ bundlerURL: "https://sandpack-bundler.codesandbox.io" }}
/>
```

Expand All @@ -47,7 +47,7 @@ You just need to set the new bundler URL in your Sandpack instance:
**Preview**
<Sandpack
template="react"
options={{ bundlerURL: "https://sandpack-bundler.pages.dev" }}
options={{ bundlerURL: "https://sandpack-bundler.codesandbox.io" }}
/>

<Callout>
Expand Down

0 comments on commit 6777c24

Please sign in to comment.