fix: update entry cache when toggling tags (#1135)

This commit is contained in:
TheBobBobs
2025-09-23 23:06:46 +00:00
committed by GitHub
parent 278adc1004
commit ec202891b2
2 changed files with 11 additions and 4 deletions

View File

@@ -163,6 +163,11 @@ class Tag(Base):
def __hash__(self) -> int:
return hash(self.id)
def __eq__(self, value: object) -> bool:
if not isinstance(value, Tag):
return False
return self.id == value.id
def __lt__(self, other: "Tag") -> bool:
return self.name < other.name

View File

@@ -149,10 +149,12 @@ class FieldContainers(QWidget):
tag = self.lib.get_tag(tag_id)
if not tag:
return
new_tags = (
entry.tags.union({tag}) if toggle_value else {t for t in entry.tags if t.id != tag_id}
)
self.update_granular(entry_tags=new_tags, entry_fields=entry.fields, update_badges=False)
if toggle_value:
entry.tags.add(tag)
else:
entry.tags.discard(tag)
self.update_granular(entry_tags=entry.tags, entry_fields=entry.fields, update_badges=False)
def hide_containers(self):
"""Hide all field and tag containers."""