Refactor(NoteList): Reshape composite note list data structure #1810
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.
When adding tag-suggestions in the note list we create a "composite list" of notes and placeholders. The placeholders designate where headers will go, where the tag suggestions list will go, and where a message will go if there are no matching notes.
There were two issues with this structure:
NoteEntity
but didn't have a key field for discriminating the type. everything works just fine but the type signatures become harder to write.data
property and that, as a render concern, wasn't necessaryFurther, we were directly mutating
notes
which came fromfilterNotes()
and the Redux state. We want to avoid directly mutating values we receive from other places in order to keep data flows clear and obvious.In this patch we are replacing the object data type for placeholders with simpler string counterparts, moving the label text into the
render
function, and exchanging a mutating operation for a non-mutating one.This is part of broader work to separate modifying the search parameters from
actually filtering the notes and was originally created as part of an
exploratory PR #1807.
Testing
This affects the tag suggestions auto-completer and the note list when searching.
Smoke test by searching in various ways: with filter text, with a tag from the tag list, with
tag:something
in the filter text, with the trash selected, with no notes matching the search, etc…In early testing at one point I had the notes header and tag-suggestions header backwards, for example.