You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sometimes impossible to recover on infinite loop crash #91
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();functionthro(){throw"";}
The thro() function is needed so that a plain throw statement doesn't break type checking, because TS thinks the lines after it are unreachable.
Interesting! I've thought about adding a "run" button but need to think a little bit more how to display that in the UI. Probably would take the form of a checkbox to toggle auto refresh and a button that would appear when that option would be checked.
As per the infinite loop issue, I'd like for the playground to automatically figure things out. Codesandbox has an option for that as well.
I wonder if looking for every JS loop and adding a counter in it which would throw if the increment is over 10k or something would be sufficient...
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.
Activity
trusktr commentedon Mar 29, 2022
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:
The
thro()function is needed so that a plainthrowstatement doesn't break type checking, because TS thinks the lines after it are unreachable.amoutonbrady commentedon Apr 2, 2022
Interesting! I've thought about adding a "run" button but need to think a little bit more how to display that in the UI. Probably would take the form of a checkbox to toggle auto refresh and a button that would appear when that option would be checked.

As per the infinite loop issue, I'd like for the playground to automatically figure things out. Codesandbox has an option for that as well.
I wonder if looking for every JS loop and adding a counter in it which would throw if the increment is over 10k or something would be sufficient...
ryansolid commentedon Apr 3, 2022
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.
amoutonbrady commentedon Apr 3, 2022
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.
milahu commentedon Sep 14, 2022
this makes the solidjs playground hang forever
bad
good
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> ); }mtranggit commentedon Apr 25, 2023
You can delete the cache of the crashing code from browser localStorage for the solidjs playground site
trusktr commentedon Sep 25, 2023
Oh yeah, right! Now that the playground remembers your previous code, refreshing always gets back to crashing state. :D