client: refactor

This commit is contained in:
Adorian Doran 2025-12-19 02:12:00 +02:00
parent 0de05ed16e
commit 32f7ae1edd

View File

@ -90,11 +90,11 @@ export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
// listening on changes of note.type and CSS class // listening on changes of note.type and CSS class
const LABELS_CAUSING_REFRESH = ["cssClass", "language", "viewType", "color"];
const noteId = this.noteContext?.noteId; const noteId = this.noteContext?.noteId;
if ( if (
loadResults.isNoteReloaded(noteId) || loadResults.isNoteReloaded(noteId) ||
loadResults.getAttributeRows().find((attr) => attr.type === "label" && ["cssClass", "language", "viewType", "color"].includes(attr.name ?? "") && attributeService.isAffecting(attr, this.noteContext?.note)) loadResults.getAttributeRows().find((attr) => attr.type === "label" && LABELS_CAUSING_REFRESH.includes(attr.name ?? "") && attributeService.isAffecting(attr, this.noteContext?.note))
) { ) {
this.refresh(); this.refresh();
} }