-
Notifications
You must be signed in to change notification settings - Fork 63
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
sometimes impossible to recover on infinite loop crash #91
Comments
As a temporary workaround, I close the tab, re-open it then quickly copy the whole text, close it, open a fresh empty playground, paste the modified text with the following added to the top to prevent it from looping: thro();
function thro() {
throw "";
} The |
Solid does have some infinite loop protection. But it only works in tight loops. I imagine if you are hitting one here it is a larger one. This makes me think it is unlikely a simple loop counter will work. |
Oh thanks Ryan for the quick heads-up, I had no idea Solid had some of this built-in! Yeah I see, I need to dig this a little bit more. It's very possible the run button in itself would be more than enough. |
this makes the solidjs playground hang forever badimport { render, For } from "solid-js/web";
import { createSignal, children } from "solid-js";
import { createStore } from "solid-js/store";
function Button(props) {
const getChildren = children(() => props.children);
const getOnClick = children(() => props.onClick); // FIXME
return (
<button type="button" onClick={(() => props.onClick)()}>
<For each={getChildren()}>{item => <div>{item}</div>}</For>
</button>
);
}
function App() {
const [store, setStore] = createStore({ count: 0 });
const increment = () => {
setStore('count', store.count + 1);
console.log(`store.count=${store.count}`);
};
return (
<Button onClick={increment}>
{store.count}
</Button>
);
}
render(() => <App />, document.getElementById("app")!); goodimport { render, For } from "solid-js/web";
import { createSignal, children } from "solid-js";
import { createStore } from "solid-js/store";
function Button(props) {
const getChildren = children(() => props.children);
const getOnClick = () => props.onClick;
return (
<button type="button" onClick={getOnClick()}>
{getChildren()}
</button>
);
}
function App() {
const [store, setStore] = createStore({ count: 0 });
const increment = () => {
setStore('count', store.count + 1);
console.log(`store.count=${store.count}`);
};
return (
<Button onClick={increment}>
{store.count}
</Button>
);
}
render(() => <App />, document.getElementById("app")!); diff function Button(props) {
const getChildren = children(() => props.children);
- const getOnClick = children(() => props.onClick); // FIXME
+ const getOnClick = () => props.onClick;
return (
- <button type="button" onClick={(() => props.onClick)()}>
- <For each={getChildren()}>{item => <div>{item}</div>}</For>
+ <button type="button" onClick={getOnClick()}>
+ {getChildren()}
</button>
);
} |
You can delete the cache of the crashing code from browser localStorage for the solidjs playground site |
Oh yeah, right! Now that the playground remembers your previous code, refreshing always gets back to crashing state. :D |
this could be mitigated with a
run
button along with an option to not automatically run on code changes (similar to codepen).The text was updated successfully, but these errors were encountered: