sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Allow showRunOnClick on Sandpack when bundler crashes because of an infinite loop

Open pantharshit00 opened this issue 6 months ago • 0 comments

Bug report

When accidentally introducing an infinite loop in a sandbox for example:

function Test() {
  return <><Test /></>
}

There is no way to recover from this on sandpack. On codesandbox it will pause execution if there is running key in the localstorage from a previous refresh.

https://github.com/codesandbox/codesandbox-client/blob/be57601fa413febd4432ca5972b887498528491b/packages/app/src/sandbox/compile.ts#L779-L799

This is explicitly disabled for sandpack. I was also unable to find a way to either get that running key from the iframe or some event so that we can show a custom run screen.

Packages affected

  • [x] sandpack-client
  • [ ] sandpack-react

Description of the problem

Add an option for like showRunOnClickIfCrashes that can provide same behavior from codesandbox.

pantharshit00 avatar Apr 09 '25 11:04 pantharshit00