sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Feature request: Manual recompilation mode

Open jog1t opened this issue 2 years ago • 5 comments

Tell us how you think we can improve Sandpack

Packages affected

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

What is this feature?

Allows developers to manually start the recompilation process.

How would your idea work?

Instead of triggering the recompilation process after some time, or immediately, it would allow developers to choose when Sandpack should recompile the changes. It could be useful in many scenarios. For example, it would allow creating a "battery optimized" mode. Where users with low battery or with slower devices can manually trigger the recompilation process by clicking, for example, "Apply changes" or "Run" button.

Do you have any examples of how you would like to see us implement it?

Yes! recompileMode in SandpackProviderProps could have another value - manual. Then, developers using this feature, would need to run https://github.com/codesandbox/sandpack/blob/main/sandpack-react/src/contexts/sandpackContext.tsx#L180-L184 manually in order to trigger the recompilation.

I wanted to say thank you, for such an amazing project! It opens such many possibilities! I'm excited to see new updates! 🙌🏻

jog1t avatar Jun 23 '22 22:06 jog1t

Hey @jog1t, that would be great!

I have added your feature request to our internal backlog which we use to prioritize what to build next. We can't make any promises about the timing, but it's on the list!

If you'd like to work on this feature with us, please create a pull request and we'll help you along the way.

For others landing on this issue, feel free to add more context or simply leave a thumbs up 👍 on this comment if you find this feature useful.

danilowoz avatar Jul 21 '22 15:07 danilowoz