Add proof of concept for saving/restoring app-db #112
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is not to be merged, but opening for discussion. It would be useful to be able to save a snapshot of app-state to be able to restore from later on, either within the same browser session or in a later one.
Current goals:
Out of scope:
I found two issues immediately with the serialisation approach I have taken:
prn
is indistinguishable from a standard map and will cause a spec exception.Both of these show that ser/de is likely to be the big blocker for this being a useful feature. I'm interested in hearing about other options here which can handle a wider range of datatypes than EDN.
One possibility is to use Transit and allow users to extend our transit readers and writers. I would probably prefer something more automatic but less compatible, like storing the memory representation and then reading it back. This is likely to be challenging for a variety of reasons though.
Another likely issue is being able to do some sort of pre and post initialisation, e.g. to synchronise localstorage, get new auth tokens, e.t.c.