Repository navigation
Conversation
If a document filename is encountered multiple times, from transaction
metadata and/or being auto-found via an `options` directive, Svelte
code would cause a UI error without displaying any data. This patch
prevents the crash.
Change summary:
- `src/fava/json_api.py` — `get_documents()` now deduplicates by
filename, preferring explicit directives over auto-discovered ones
- `frontend/src/reports/documents/Table.svelte` — Svelte `{#each}` key
changed from `doc.filename` to `doc.entry_hash`
- `tests/test_json_api.py` — Two new tests: one for explicit +
auto-discovered dedup, one for two explicit directives
cvaske
force-pushed
the
cv/issue-2281-doc-dupes
branch
from
May 17, 2026 22:00
3c0a73d to
bb09abf
Compare
cvaske
marked this pull request as draft
May 17, 2026 22:02
cvaske
marked this pull request as ready for review
May 17, 2026 23:26
yagebu
reviewed
May 19, 2026
| </thead> | ||
| <tbody> | ||
| {#each sorted_documents as doc (doc.filename)} | ||
| {#each sorted_documents as doc (doc.entry_hash)} |
Member
There was a problem hiding this comment.
Does this work? Wouldn't duplicate documents also not have the same entry hash?
Contributor
Author
There was a problem hiding this comment.
This works for the test case in #2281, which is not surprising because the API change below deduplicates the file.
Moreover, if the API level changes below are removed, then the API returns the duplicate files, the entry_hashes are different, and the display continues to work, even though they have the same filename. I haven't looked deep enough into the beancount repo to find out what precisely gets hashed from the objects.
Member
|
I went with just showing the duplicates in #2290 |
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.
If a document filename is encountered multiple times, from transaction metadata and/or being auto-found via an
optionsdirective, Svelte code would cause a UI error without displaying any data. Fixes #2281Change summary:
src/fava/json_api.py—get_documents()now deduplicates by filename, preferring explicit directives over auto-discovered onesfrontend/src/reports/documents/Table.svelte— Svelte{#each}key changed fromdoc.filenametodoc.entry_hashtests/test_json_api.py— Two new tests: one for explicit + auto-discovered dedup, one for two explicit directives