Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor(NoteList): Reshape composite note list data structure (#1810)
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: - it was difficult to type because of how its structure overlapped a `NoteEntity` but didn't have a key field for discriminating the type. everything works just fine but the type signatures become harder to write. - we were storing display information in the `data` property and that, as a render concern, wasn't necessary Further, we were directly mutating `notes` which came from `filterNotes()` 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.
- Loading branch information