-
-
Notifications
You must be signed in to change notification settings - Fork 418
perf: Optimize db queries for preview panel #942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4ef7c13
to
59460e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for getting around to this one so late. Everything seems to be working as intended and I'm glad that the tag hierarchy logic is now finally back into its own method. Thank you for working on this, and great changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to backtrack on this, but it appears that this conflicts with a recent bugfix we had to correct an issue where the parent_id
and child_id
columns were erroneously flipped in the tag_parents
table (#998). I attempted to update the logic in get_tag_hierarchy()
and get_tag_categories()
, but I'm not as familiar with these changes compared to the old code and wasn't able to get it working on my own. This also illuminated some quirks in the logic of get_tag_hierarchy()
that resulted in the issue propagating and becoming more difficult to track down.
Would you mind seeing if you can update this to the latest code on main
?
for tag in tags: | ||
all_tags[tag.id] = tag | ||
for tag in all_tags.values(): | ||
tag.parent_tags = {all_tags[p] for p in all_tag_parents.get(tag.id, [])} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning Tag objects with overwritten parent data resulted in the conflict issue propagating further in the UI stack, including flipping the tag's parents with its children in the BuildTagPanel due to the UI sharing that same "tainted" Tag object. While this shouldn't be an issue when the logic if flipped to match main
, it still presents the question of whether or not this may mask further issues in the future.
Summary
Add method
get_tag_hierarchy
toLibrary
that returns adict[TagId, list[ParentId]]
anddict[TagId, Tag]
containing every tag in the hierarchy. UpdateFieldContainers
to use this new method.Currently all places that call
Library.tag_display_name
already have theTag
object so we don't need to fetch it from db.Tasks Completed