homotopy-io / homotopy-webclient

https://homotopy.io
27 stars 5 forks source link

[WIP] Implementing Export/Import #36

Closed NickHu closed 5 years ago

NickHu commented 5 years ago

This change introduces redux-persist to manage persistent state of the application. With this mechanism, every state change of the application is written to local storage, and on page reload, the state is read from local storage (can be cleared in console by calling localStorage.clear()); once it works, importing and exporting would be easy to implement on top. Undo is another feature which would easily follow from this one.

However, it doesn't work yet (hence WIP). In essence, there is some state it is not able to automatically reinitialise, particularly concerning Core. First, we need a way to properly serialise Diagram state (to JSON) (see TODOs in the commit). So far, it does manage to save a signature of only 0-cells: create a new 0-cell, reload the page, and viola - it's still there.

There is an export button in the header now which does allow for downloading the serialised state (with TODOs) as a JSON file.