Repository navigation
feat(favorites): export and import a library as JSON - #616
Merged
Merged
Conversation
Someone with two hundred favorites had no way to back them up or hand them to a colleague (#335). Both directions now exist, from the panel's header. The file is versioned from the start. Something people are told to keep and share will outlive the shape that wrote it, and a reader that cannot tell which version it holds is left guessing. Import merges rather than replacing, which is what FR-9.2.4 asks for. Identity for merging is name-and-category — the pair the store already refuses to duplicate — so importing the same file twice imports nothing the second time. Ids are regenerated, because they are per-install counters and a file from someone else's machine could collide with a local one. Empty categories carry across too: someone who organised their library before filling it should get the shelves as well as the books. An import is scrubbed on the way in, since an export written before #339 can carry a credential. The report says what happened to everything in the file, not just the good half. "Imported 3" when the file held forty is a report worth doubting, so skipped and unreadable entries are counted and shown. A file that is not JSON, or is JSON but not an export, says so rather than importing nothing and calling it success. Closes #335 Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #335.
Someone with two hundred favorites had no way to back them up or hand them to a colleague. Both directions now exist, from the panel's header.
Design points
The report says what happened to the whole file
"Imported 3" when the file held forty is a report worth doubting, so skipped and unreadable entries are counted and shown. A file that isn't JSON, or is JSON but isn't an export, says so rather than importing nothing and calling it success.
A test-isolation note
The
apimocks live in a module factory and keep their calls between tests. One test's export looked like the next one's until they were reset — caught by the cancelled-dialog test, which is exactly the one that would notice.Verification
13 store tests, 7 UI tests. Unit 2074, browser 297, 0 lint errors.