feat: add ability to save files#204
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #204 +/- ##
==========================================
+ Coverage 71.99% 72.13% +0.14%
==========================================
Files 97 99 +2
Lines 4859 4974 +115
Branches 391 405 +14
==========================================
+ Hits 3498 3588 +90
- Misses 1344 1369 +25
Partials 17 17
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
cguedes
previously approved these changes
Jun 27, 2023
cguedes
previously approved these changes
Jun 28, 2023
cguedes
approved these changes
Jun 28, 2023
Collaborator
|
Exciting that we can persist files now! Two questions:
|
Collaborator
Author
|
Collaborator
|
@danvk we've had to update the references model (FE), and since we persist that information in the localStorage sometimes you need to reset that info using the UI (i.e. "DEBUG: reset references store") or directly via dev tools (Application > Storage). I normally also run the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds the ability to save files:
File->SaveScreen.Recording.2023-06-27.at.13.06.39.mov
Implementation choices:
Four atoms are available for files:
loadableFileAtomis the atom containing the loadable file (the state isloadingwhen initially reading the file from disk, and should stayhasDataafterwards)updateFileBufferAtomupdates a buffer atom. This is currently updated on every update in the editor. The need of a buffer comes from the fact that updating the actual atom triggers a re-render of the editor, that deletes the history and resets focussaveFileInMemoryAtomsaves the content of the buffer in theloadableFileAtom. This atom is currently called when an editor instance is unmounted (ie. when switching between tabs)saveFileAtomactually writes the content of the buffer on the disk. It does NOT update theloadableFileAtom, to prevent the editor from re-rendering and resetting focus and history.Closes #197