Update sandboxes feature
It would be great to have the possibility to update existing sandboxes during deployment, instead of always creating new ones.
Could certainly help with implementation, just aint sure what it would take in current codebase - some pointers at least would be helpful.
Good one! This should certainly be possible, the main question is how to determine that it's actually the same sandbox.
I'm thinking of something like this:
- (when sandbox is new) Request to create sandbox will be made to the server
- Server returns sandbox id
- We save the sandbox id somewhere related to this project (where?)
- Next requests will provide the ID so the API knows to update
The backend functionality is already there, so it's mostly a matter of figuring out how to 'remember' sandboxes.
What do you think?
I thought even of the simpler way thing - just pass sandbox id as argument. I think this still should be considered and added as it might be useful for someone.
However your proposal of remembering the id somewhere sound way more awesome ;)
I think there shouldnt be any magic here, just create something like .codesanbox.json with the sandbox's id and we are good to go. It has also the benefit of being 'remembered' across machines.
Also - the authorization at the moment is github based, I'm wondering - is it possible to authorize CI somehow? Would be cool to have examples updated automatically in CI environment.
I think there shouldnt be any magic here, just create something like .codesanbox.json with the sandbox's id and we are good to go. It has also the benefit of being 'remembered' across machines.
I like this idea! Especially the fact that it will be remembered between machines is nice.
Also - the authorization at the moment is github based, I'm wondering - is it possible to authorize CI somehow? Would be cool to have examples updated automatically in CI environment.
This would be really valuable to have. It is possible theoretically possible to authorize without any account. I disabled this because I didn't want to risk malicious usage (like 10.000 sandboxes created at once). We already have a token system in place to allow others to deploy under your name (like we do with the CLI). I'll check how Netlify/Now approach this.
I think there shouldnt be any magic here, just create something like .codesanbox.json with the sandbox's id and we are good to go. It has also the benefit of being 'remembered' across machines.
I like this idea! Especially the fact that it will be remembered between machines is nice.
Gonna look into providing a PR for this then :)
This would be really valuable to have. It is possible theoretically possible to authorize without any account. I disabled this because I didn't want to risk malicious usage (like 10.000 sandboxes created at once). We already have a token system in place to allow others to deploy under your name (like we do with the CLI). I'll check how Netlify/Now approach this.
OTOH this one seems like a more complex and deeper dive into the architecture would be needed, would prefer creating separate issue for this and put it for grasp as "help wanted".
Gonna look into providing a PR for this then :)
That's great!! Thanks a lot. Regarding the API call, if you update the sandbox you need to call /api/v1/sandboxes/:id instead of /api/v1/sandboxes. I believe you can keep the POST method.
OTOH this one seems like a more complex and deeper dive into the architecture would be needed, would prefer creating separate issue for this and put it for grasp as "help wanted".
Agreed.