MLH-Fellowship / babel-sandbox

Babel repl-like codesandbox: check out link =>
https://codesandbox.io/s/github/babel/sandboxes
MIT License
6 stars 3 forks source link

Add feature: forking and saving #77

Closed garrettluu closed 4 years ago

garrettluu commented 4 years ago

Closes #28, addresses #27

This PR adds UI elements to fork and save a config. I ran into several issues as I was doing this, stemming from the problem of not being able to get the id of the current config (since that isn't stored in the state anywhere). So I propose a new process for forking:

~TODO~ done!

garrettluu commented 4 years ago

Finally added displaying forks! Not sure how much I should style this since the UI and layout are probably gonna change soon. image

garrettluu commented 4 years ago

Tested forking with the backend and it seems to work and create new blobs, but I would also like to track the forks of the parent in an array in the blob (this is a backend task @mohammedsahl).

If we start with this blob

{
  "id": "example1",
  "forkedFrom": "",
  "forks": []
}

and we fork it to generate this blob

{
  "id": "example2",
  "forkedFrom": "example1",
  "forks": []
}

the forks array of example1 should contain example2 as an element: "forks": ["example2"]

Currently, the forks array seems to always be empty or null.

mohammedsahl commented 4 years ago

Currently, the forks array seems to always be empty or null.

Okay so this seems to be an issue(?) with async DB updates. If you GET example1 after forking it should have forks : ["example2"]

Edit: It appears that forks: [...] is not part of the res body when GETing a single blob, I'll add that right away

garrettluu commented 4 years ago

Tested with real data from backend and everything seems to work! 😀 image

wlawt commented 4 years ago

We should also update the docs about how the forking logic works just to clarify.

The current process is:

ianjennings commented 4 years ago
./src/components/MainMenu.js
Module not found: Can't resolve './ForkModal' in '/home/ianjennings/Development-Unix/babel-sandbox/src/components'

I don't see this file in my local copy, do you need to commit it?