From e6bf6424e856fac09f0729fa1b2bb6fcfad9d904 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 5 Jun 2023 16:12:02 +0200 Subject: [PATCH] rename loadresults methods/properties for clarity that they don't contain entities, only rows --- ...0221__rename_note_revision_to_revision.sql | 2 +- package-lock.json | 1 - src/public/app/components/note_context.js | 2 +- .../app/components/shortcut_component.js | 2 +- src/public/app/services/froca_updater.js | 4 +- src/public/app/services/load_results.js | 62 +++++++++---------- src/public/app/widgets/attachment_detail.js | 3 +- .../attribute_widgets/attribute_editor.js | 2 +- src/public/app/widgets/bookmark_buttons.js | 4 +- src/public/app/widgets/bookmark_switch.js | 2 +- .../app/widgets/buttons/button_from_note.js | 2 +- src/public/app/widgets/buttons/edit_button.js | 2 +- .../buttons/launcher/abstract_launcher.js | 2 +- .../widgets/containers/launcher_container.js | 2 +- .../widgets/containers/ribbon_container.js | 2 +- .../app/widgets/dialogs/bulk_actions.js | 2 +- src/public/app/widgets/editability_select.js | 2 +- src/public/app/widgets/highlights_list.js | 2 +- src/public/app/widgets/note_detail.js | 2 +- src/public/app/widgets/note_icon.js | 2 +- src/public/app/widgets/note_list.js | 2 +- src/public/app/widgets/note_map.js | 2 +- src/public/app/widgets/note_tree.js | 8 +-- src/public/app/widgets/note_wrapper.js | 2 +- .../widgets/ribbon_widgets/book_properties.js | 2 +- .../inherited_attribute_list.js | 2 +- .../app/widgets/ribbon_widgets/note_paths.js | 2 +- .../ribbon_widgets/promoted_attributes.js | 2 +- .../ribbon_widgets/search_definition.js | 2 +- src/public/app/widgets/shared_info.js | 4 +- src/public/app/widgets/shared_switch.js | 2 +- src/public/app/widgets/tab_row.js | 2 +- src/public/app/widgets/toc.js | 2 +- .../widgets/type_widgets/attachment_detail.js | 2 +- .../widgets/type_widgets/attachment_list.js | 3 +- .../app/widgets/type_widgets/web_view.js | 2 +- 36 files changed, 71 insertions(+), 74 deletions(-) diff --git a/db/migrations/0221__rename_note_revision_to_revision.sql b/db/migrations/0221__rename_note_revision_to_revision.sql index 59409d840..780099872 100644 --- a/db/migrations/0221__rename_note_revision_to_revision.sql +++ b/db/migrations/0221__rename_note_revision_to_revision.sql @@ -22,4 +22,4 @@ CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdite CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`); CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`); -UPDATE entity_changes SET entity_name = 'revisions' WHERE entity_name = 'note_revisions'; +UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions'; diff --git a/package-lock.json b/package-lock.json index 56d259cbc..f93d24812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "trilium", "version": "0.60.1-beta", "hasInstallScript": true, "license": "AGPL-3.0-only", diff --git a/src/public/app/components/note_context.js b/src/public/app/components/note_context.js index 9e0716cb3..de39313e4 100644 --- a/src/public/app/components/note_context.js +++ b/src/public/app/components/note_context.js @@ -241,7 +241,7 @@ class NoteContext extends Component { async entitiesReloadedEvent({loadResults}) { if (loadResults.isNoteReloaded(this.noteId)) { - const note = loadResults.getEntity('notes', this.noteId); + const note = loadResults.getEntityRow('notes', this.noteId); if (note.isDeleted) { this.noteId = null; diff --git a/src/public/app/components/shortcut_component.js b/src/public/app/components/shortcut_component.js index 9df62d7bb..dfe0dde36 100644 --- a/src/public/app/components/shortcut_component.js +++ b/src/public/app/components/shortcut_component.js @@ -27,7 +27,7 @@ export default class ShortcutComponent extends Component { } async entitiesReloadedEvent({loadResults}) { - for (const attr of loadResults.getAttributes()) { + for (const attr of loadResults.getAttributeRows()) { if (attr.type === 'label' && attr.name === 'keyboardShortcut') { const note = await froca.getNote(attr.noteId); // launcher shortcuts are handled specifically diff --git a/src/public/app/services/froca_updater.js b/src/public/app/services/froca_updater.js index 27afe7cb1..74051aff5 100644 --- a/src/public/app/services/froca_updater.js +++ b/src/public/app/services/froca_updater.js @@ -262,7 +262,7 @@ function processAttachment(loadResults, ec) { note.attachments = note.attachments.filter(att => att.attachmentId !== attachment.attachmentId); } - loadResults.addAttachment(ec.entity); + loadResults.addAttachmentRow(ec.entity); delete froca.attachments[ec.entityId]; } @@ -280,7 +280,7 @@ function processAttachment(loadResults, ec) { } } - loadResults.addAttachment(ec.entity); + loadResults.addAttachmentRow(ec.entity); } export default { diff --git a/src/public/app/services/load_results.js b/src/public/app/services/load_results.js index 59c0a9ebe..af36f7d8e 100644 --- a/src/public/app/services/load_results.js +++ b/src/public/app/services/load_results.js @@ -12,22 +12,22 @@ export default class LoadResults { this.noteIdToComponentId = {}; this.componentIdToNoteIds = {}; - this.branches = []; + this.branchRows = []; - this.attributes = []; + this.attributeRows = []; this.noteReorderings = []; - this.revisions = []; + this.revisionRows = []; this.contentNoteIdToComponentId = []; - this.options = []; + this.optionNames = []; - this.attachments = []; + this.attachmentRows = []; } - getEntity(entityName, entityId) { + getEntityRow(entityName, entityId) { return this.entities[entityName]?.[entityId]; } @@ -46,12 +46,12 @@ export default class LoadResults { } addBranch(branchId, componentId) { - this.branches.push({branchId, componentId}); + this.branchRows.push({branchId, componentId}); } - getBranches() { - return this.branches - .map(row => this.getEntity("branches", row.branchId)) + getBranchRows() { + return this.branchRows + .map(row => this.getEntityRow("branches", row.branchId)) .filter(branch => !!branch); } @@ -64,23 +64,23 @@ export default class LoadResults { } addAttribute(attributeId, componentId) { - this.attributes.push({attributeId, componentId}); + this.attributeRows.push({attributeId, componentId}); } /** @returns {FAttribute[]} */ - getAttributes(componentId = 'none') { - return this.attributes + getAttributeRows(componentId = 'none') { + return this.attributeRows .filter(row => row.componentId !== componentId) - .map(row => this.getEntity("attributes", row.attributeId)) + .map(row => this.getEntityRow("attributes", row.attributeId)) .filter(attr => !!attr); } addRevision(revisionId, noteId, componentId) { - this.revisions.push({revisionId, noteId, componentId}); + this.revisionRows.push({revisionId, noteId, componentId}); } hasRevisionForNote(noteId) { - return !!this.revisions.find(nr => nr.noteId === noteId); + return !!this.revisionRows.find(row => row.noteId === noteId); } getNoteIds() { @@ -111,19 +111,19 @@ export default class LoadResults { } addOption(name) { - this.options.push(name); + this.optionNames.push(name); } isOptionReloaded(name) { - return this.options.includes(name); + return this.optionNames.includes(name); } - addAttachment(attachment) { - this.attachments.push(attachment); + addAttachmentRow(attachment) { + this.attachmentRows.push(attachment); } - getAttachments() { - return this.attachments; + getAttachmentRows() { + return this.attachmentRows; } /** @@ -131,25 +131,25 @@ export default class LoadResults { * notably changes in note itself should not have any effect on attributes */ hasAttributeRelatedChanges() { - return this.branches.length > 0 - || this.attributes.length > 0; + return this.branchRows.length > 0 + || this.attributeRows.length > 0; } isEmpty() { return Object.keys(this.noteIdToComponentId).length === 0 - && this.branches.length === 0 - && this.attributes.length === 0 + && this.branchRows.length === 0 + && this.attributeRows.length === 0 && this.noteReorderings.length === 0 - && this.revisions.length === 0 + && this.revisionRows.length === 0 && this.contentNoteIdToComponentId.length === 0 - && this.options.length === 0 - && this.attachments.length === 0; + && this.optionNames.length === 0 + && this.attachmentRows.length === 0; } isEmptyForTree() { return Object.keys(this.noteIdToComponentId).length === 0 - && this.branches.length === 0 - && this.attributes.length === 0 + && this.branchRows.length === 0 + && this.attributeRows.length === 0 && this.noteReorderings.length === 0; } } diff --git a/src/public/app/widgets/attachment_detail.js b/src/public/app/widgets/attachment_detail.js index b85bea9e3..8b8c60d28 100644 --- a/src/public/app/widgets/attachment_detail.js +++ b/src/public/app/widgets/attachment_detail.js @@ -1,7 +1,6 @@ import utils from "../services/utils.js"; import AttachmentActionsWidget from "./buttons/attachments_actions.js"; import BasicWidget from "./basic_widget.js"; -import server from "../services/server.js"; import options from "../services/options.js"; import imageService from "../services/image.js"; import linkService from "../services/link.js"; @@ -192,7 +191,7 @@ export default class AttachmentDetailWidget extends BasicWidget { } async entitiesReloadedEvent({loadResults}) { - const attachmentChange = loadResults.getAttachments().find(att => att.attachmentId === this.attachment.attachmentId); + const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachment.attachmentId); if (attachmentChange) { if (attachmentChange.isDeleted) { diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.js b/src/public/app/widgets/attribute_widgets/attribute_editor.js index beba04d89..cef05b895 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_editor.js +++ b/src/public/app/widgets/attribute_widgets/attribute_editor.js @@ -520,7 +520,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { + if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { this.refresh(); } } diff --git a/src/public/app/widgets/bookmark_buttons.js b/src/public/app/widgets/bookmark_buttons.js index 77a9ec893..1bc534527 100644 --- a/src/public/app/widgets/bookmark_buttons.js +++ b/src/public/app/widgets/bookmark_buttons.js @@ -38,11 +38,11 @@ export default class BookmarkButtons extends FlexContainer { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getBranches().find(branch => branch.parentNoteId === '_lbBookmarks')) { + if (loadResults.getBranchRows().find(branch => branch.parentNoteId === '_lbBookmarks')) { this.refresh(); } - if (loadResults.getAttributes().find(attr => attr.type === 'label' + if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && ['iconClass', 'workspaceIconClass', 'bookmarkFolder'].includes(attr.name) && this.noteIds.includes(attr.noteId)) ) { diff --git a/src/public/app/widgets/bookmark_switch.js b/src/public/app/widgets/bookmark_switch.js index b33a752b9..22040e3e8 100644 --- a/src/public/app/widgets/bookmark_switch.js +++ b/src/public/app/widgets/bookmark_switch.js @@ -35,7 +35,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getBranches().find(b => b.noteId === this.noteId)) { + if (loadResults.getBranchRows().find(b => b.noteId === this.noteId)) { this.refresh(); } } diff --git a/src/public/app/widgets/buttons/button_from_note.js b/src/public/app/widgets/buttons/button_from_note.js index d8d08791e..31d93195a 100644 --- a/src/public/app/widgets/buttons/button_from_note.js +++ b/src/public/app/widgets/buttons/button_from_note.js @@ -42,7 +42,7 @@ export default class ButtonFromNoteWidget extends CommandButtonWidget { return; } - if (loadResults.getAttributes(this.componentId).find(attr => + if (loadResults.getAttributeRows(this.componentId).find(attr => attr.type === 'label' && attr.name === 'iconClass' && attributeService.isAffecting(attr, buttonNote))) { diff --git a/src/public/app/widgets/buttons/edit_button.js b/src/public/app/widgets/buttons/edit_button.js index a161f7540..daf29c097 100644 --- a/src/public/app/widgets/buttons/edit_button.js +++ b/src/public/app/widgets/buttons/edit_button.js @@ -53,7 +53,7 @@ export default class EditButton extends OnClickButtonWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find( + if (loadResults.getAttributeRows().find( attr => attr.type === 'label' && attr.name.toLowerCase().includes("readonly") && attributeService.isAffecting(attr, this.note) diff --git a/src/public/app/widgets/buttons/launcher/abstract_launcher.js b/src/public/app/widgets/buttons/launcher/abstract_launcher.js index 02948e338..87bfbd6d0 100644 --- a/src/public/app/widgets/buttons/launcher/abstract_launcher.js +++ b/src/public/app/widgets/buttons/launcher/abstract_launcher.js @@ -31,7 +31,7 @@ export default class AbstractLauncher extends OnClickButtonWidget { } entitiesReloadedEvent({loadResults}) { - for (const attr of loadResults.getAttributes()) { + for (const attr of loadResults.getAttributeRows()) { if (attr.noteId === this.launcherNote.noteId && attr.type === 'label' && attr.name === 'keyboardShortcut') { this.bindNoteShortcutHandler(attr); } else if (attr.type === 'label' && attr.name === 'iconClass' && attributesService.isAffecting(attr, this.launcherNote)) { diff --git a/src/public/app/widgets/containers/launcher_container.js b/src/public/app/widgets/containers/launcher_container.js index 1c1859048..a278dfe9c 100644 --- a/src/public/app/widgets/containers/launcher_container.js +++ b/src/public/app/widgets/containers/launcher_container.js @@ -66,7 +66,7 @@ export default class LauncherContainer extends FlexContainer { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getBranches().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) { + if (loadResults.getBranchRows().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) { // changes in note placement requires reload of all launchers, all other changes are handled by individual // launchers this.load(); diff --git a/src/public/app/widgets/containers/ribbon_container.js b/src/public/app/widgets/containers/ribbon_container.js index e9fbd307c..31a0f6d1a 100644 --- a/src/public/app/widgets/containers/ribbon_container.js +++ b/src/public/app/widgets/containers/ribbon_container.js @@ -346,7 +346,7 @@ export default class RibbonContainer extends NoteContextAwareWidget { this.refresh(); } - else if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { + else if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { this.refreshWithNote(this.note, true); } } diff --git a/src/public/app/widgets/dialogs/bulk_actions.js b/src/public/app/widgets/dialogs/bulk_actions.js index fedd34e01..6e635b050 100644 --- a/src/public/app/widgets/dialogs/bulk_actions.js +++ b/src/public/app/widgets/dialogs/bulk_actions.js @@ -147,7 +147,7 @@ export default class BulkActionsDialog extends BasicWidget { entitiesReloadedEvent({loadResults}) { // only refreshing deleted attrs, otherwise components update themselves - if (loadResults.getAttributes().find(attr => + if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'action' && attr.noteId === '_bulkAction' diff --git a/src/public/app/widgets/editability_select.js b/src/public/app/widgets/editability_select.js index e03b8849d..3aedd38e3 100644 --- a/src/public/app/widgets/editability_select.js +++ b/src/public/app/widgets/editability_select.js @@ -85,7 +85,7 @@ export default class EditabilitySelectWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId)) { + if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId)) { this.refresh(); } } diff --git a/src/public/app/widgets/highlights_list.js b/src/public/app/widgets/highlights_list.js index 4e88e9e45..52be3092f 100644 --- a/src/public/app/widgets/highlights_list.js +++ b/src/public/app/widgets/highlights_list.js @@ -232,7 +232,7 @@ export default class HighlightsListWidget extends RightPanelWidget { async entitiesReloadedEvent({loadResults}) { if (loadResults.isNoteContentReloaded(this.noteId)) { await this.refresh(); - } else if (loadResults.getAttributes().find(attr => attr.type === 'label' + } else if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && (attr.name.toLowerCase().includes('readonly') || attr.name === 'hideHighlightWidget') && attributeService.isAffecting(attr, this.note))) { await this.refresh(); diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 833ee93da..433393330 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -312,7 +312,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { this.triggerEvent('noteTypeMimeChanged', {noteId: this.noteId}); } else { - const attrs = loadResults.getAttributes(); + const attrs = loadResults.getAttributeRows(); const label = attrs.find(attr => attr.type === 'label' diff --git a/src/public/app/widgets/note_icon.js b/src/public/app/widgets/note_icon.js index ba2bbb683..03653423a 100644 --- a/src/public/app/widgets/note_icon.js +++ b/src/public/app/widgets/note_icon.js @@ -129,7 +129,7 @@ export default class NoteIconWidget extends NoteContextAwareWidget { return; } - for (const attr of loadResults.getAttributes()) { + for (const attr of loadResults.getAttributeRows()) { if (attr.type === 'label' && ['iconClass', 'workspaceIconClass'].includes(attr.name) && attributeService.isAffecting(attr, this.note)) { diff --git a/src/public/app/widgets/note_list.js b/src/public/app/widgets/note_list.js index 37b27e0c5..5c8026163 100644 --- a/src/public/app/widgets/note_list.js +++ b/src/public/app/widgets/note_list.js @@ -93,7 +93,7 @@ export default class NoteListWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && ['viewType', 'expanded', 'pageSize'].includes(attr.name))) { + if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId && ['viewType', 'expanded', 'pageSize'].includes(attr.name))) { this.shownNoteId = null; // force render this.checkRenderStatus(); diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.js index 65fceedd2..88210efb2 100644 --- a/src/public/app/widgets/note_map.js +++ b/src/public/app/widgets/note_map.js @@ -429,7 +429,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes(this.componentId).find( + if (loadResults.getAttributeRows(this.componentId).find( attr => attr.type === 'label' && ['mapType', 'mapRootNoteId'].includes(attr.name) diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 025be454e..5d3c6ede8 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -1082,7 +1082,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { const noteIdsToUpdate = new Set(); const noteIdsToReload = new Set(); - for (const ecAttr of loadResults.getAttributes()) { + for (const ecAttr of loadResults.getAttributeRows()) { const dirtyingLabels = ['iconClass', 'cssClass', 'workspace', 'workspaceIconClass', 'color']; if (ecAttr.type === 'label' && dirtyingLabels.includes(ecAttr.name)) { @@ -1124,10 +1124,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { let movedActiveNode = null; let parentsOfAddedNodes = []; - const allBranches = loadResults.getBranches(); - const allBranchesDeleted = allBranches.every(branch => !!branch.isDeleted); + const allBranchRows = loadResults.getBranchRows(); + const allBranchesDeleted = allBranchRows.every(branch => !!branch.isDeleted); - for (const ecBranch of allBranches) { + for (const ecBranch of allBranchRows) { if (ecBranch.parentNoteId === '_share') { // all shared notes have a sign in the tree, even the descendants of shared notes noteIdsToReload.add(ecBranch.noteId); diff --git a/src/public/app/widgets/note_wrapper.js b/src/public/app/widgets/note_wrapper.js index c91e42e80..a724c3b6d 100644 --- a/src/public/app/widgets/note_wrapper.js +++ b/src/public/app/widgets/note_wrapper.js @@ -60,7 +60,7 @@ export default class NoteWrapperWidget extends FlexContainer { const noteId = this.noteContext?.noteId; if (loadResults.isNoteReloaded(noteId) - || loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) { + || loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'cssClass' && attributeService.isAffecting(attr, this.noteContext?.note))) { this.refresh(); } diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.js b/src/public/app/widgets/ribbon_widgets/book_properties.js index 3bc1e51fc..48861150d 100644 --- a/src/public/app/widgets/ribbon_widgets/book_properties.js +++ b/src/public/app/widgets/ribbon_widgets/book_properties.js @@ -108,7 +108,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && attr.name === 'viewType')) { + if (loadResults.getAttributeRows().find(attr => attr.noteId === this.noteId && attr.name === 'viewType')) { this.refresh(); } } diff --git a/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js b/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js index 01031686e..9445d088a 100644 --- a/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js +++ b/src/public/app/widgets/ribbon_widgets/inherited_attribute_list.js @@ -107,7 +107,7 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { + if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { this.refresh(); } } diff --git a/src/public/app/widgets/ribbon_widgets/note_paths.js b/src/public/app/widgets/ribbon_widgets/note_paths.js index e57b75e8f..7d8f2102d 100644 --- a/src/public/app/widgets/ribbon_widgets/note_paths.js +++ b/src/public/app/widgets/ribbon_widgets/note_paths.js @@ -135,7 +135,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getBranches().find(branch => branch.noteId === this.noteId) + if (loadResults.getBranchRows().find(branch => branch.noteId === this.noteId) || loadResults.isNoteReloaded(this.noteId)) { this.refresh(); diff --git a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js index d9aa57419..8293875ee 100644 --- a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js +++ b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js @@ -318,7 +318,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { + if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { this.refresh(); } } diff --git a/src/public/app/widgets/ribbon_widgets/search_definition.js b/src/public/app/widgets/ribbon_widgets/search_definition.js index baa6dfdd9..d30484bc6 100644 --- a/src/public/app/widgets/ribbon_widgets/search_definition.js +++ b/src/public/app/widgets/ribbon_widgets/search_definition.js @@ -312,7 +312,7 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget { entitiesReloadedEvent({loadResults}) { // only refreshing deleted attrs, otherwise components update themselves - if (loadResults.getAttributes().find(attr => attr.type === 'label' && attr.name === 'action' && attr.isDeleted)) { + if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'action' && attr.isDeleted)) { this.refresh(); } } diff --git a/src/public/app/widgets/shared_info.js b/src/public/app/widgets/shared_info.js index ebdfbb108..72429272e 100644 --- a/src/public/app/widgets/shared_info.js +++ b/src/public/app/widgets/shared_info.js @@ -62,10 +62,10 @@ export default class SharedInfoWidget extends NoteContextAwareWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.name.startsWith('_share') && attributeService.isAffecting(attr, this.note))) { + if (loadResults.getAttributeRows().find(attr => attr.name.startsWith('_share') && attributeService.isAffecting(attr, this.note))) { this.refresh(); } - else if (loadResults.getBranches().find(branch => branch.noteId === this.noteId)) { + else if (loadResults.getBranchRows().find(branch => branch.noteId === this.noteId)) { this.refresh(); } } diff --git a/src/public/app/widgets/shared_switch.js b/src/public/app/widgets/shared_switch.js index a7aaa1e52..c779db22c 100644 --- a/src/public/app/widgets/shared_switch.js +++ b/src/public/app/widgets/shared_switch.js @@ -69,7 +69,7 @@ export default class SharedSwitchWidget extends SwitchWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getBranches().find(b => b.noteId === this.noteId)) { + if (loadResults.getBranchRows().find(b => b.noteId === this.noteId)) { this.refresh(); } } diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.js index 17f478a47..3308d2449 100644 --- a/src/public/app/widgets/tab_row.js +++ b/src/public/app/widgets/tab_row.js @@ -681,7 +681,7 @@ export default class TabRowWidget extends BasicWidget { } if (loadResults.isNoteReloaded(noteContext.noteId) || - loadResults.getAttributes().find(attr => + loadResults.getAttributeRows().find(attr => ['workspace', 'workspaceIconClass', 'workspaceTabBackgroundColor'].includes(attr.name) && attributeService.isAffecting(attr, noteContext.note)) ) { diff --git a/src/public/app/widgets/toc.js b/src/public/app/widgets/toc.js index 1c7418d05..604d3bf80 100644 --- a/src/public/app/widgets/toc.js +++ b/src/public/app/widgets/toc.js @@ -226,7 +226,7 @@ export default class TocWidget extends RightPanelWidget { async entitiesReloadedEvent({loadResults}) { if (loadResults.isNoteContentReloaded(this.noteId)) { await this.refresh(); - } else if (loadResults.getAttributes().find(attr => attr.type === 'label' + } else if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && (attr.name.toLowerCase().includes('readonly') || attr.name === 'toc') && attributeService.isAffecting(attr, this.note))) { diff --git a/src/public/app/widgets/type_widgets/attachment_detail.js b/src/public/app/widgets/type_widgets/attachment_detail.js index 0321d5440..95efd5fdd 100644 --- a/src/public/app/widgets/type_widgets/attachment_detail.js +++ b/src/public/app/widgets/type_widgets/attachment_detail.js @@ -72,7 +72,7 @@ export default class AttachmentDetailTypeWidget extends TypeWidget { } async entitiesReloadedEvent({loadResults}) { - const attachmentChange = loadResults.getAttachments().find(att => att.attachmentId === this.attachmentId); + const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachmentId); if (attachmentChange?.isDeleted) { this.refresh(); // all other updates are handled within AttachmentDetailWidget diff --git a/src/public/app/widgets/type_widgets/attachment_list.js b/src/public/app/widgets/type_widgets/attachment_list.js index 522e40dcd..6ba5df21b 100644 --- a/src/public/app/widgets/type_widgets/attachment_list.js +++ b/src/public/app/widgets/type_widgets/attachment_list.js @@ -1,5 +1,4 @@ import TypeWidget from "./type_widget.js"; -import server from "../../services/server.js"; import AttachmentDetailWidget from "../attachment_detail.js"; import linkService from "../../services/link.js"; @@ -72,7 +71,7 @@ export default class AttachmentListTypeWidget extends TypeWidget { async entitiesReloadedEvent({loadResults}) { // updates and deletions are handled by the detail, for new attachments the whole list has to be refreshed - const attachmentsAdded = loadResults.getAttachments() + const attachmentsAdded = loadResults.getAttachmentRows() .some(att => !this.renderedAttachmentIds.has(att.attachmentId)); if (attachmentsAdded) { diff --git a/src/public/app/widgets/type_widgets/web_view.js b/src/public/app/widgets/type_widgets/web_view.js index 766bb608b..34e8fa65c 100644 --- a/src/public/app/widgets/type_widgets/web_view.js +++ b/src/public/app/widgets/type_widgets/web_view.js @@ -66,7 +66,7 @@ export default class WebViewTypeWidget extends TypeWidget { } entitiesReloadedEvent({loadResults}) { - if (loadResults.getAttributes().find(attr => attr.name === 'webViewSrc' && attributeService.isAffecting(attr, this.noteContext.note))) { + if (loadResults.getAttributeRows().find(attr => attr.name === 'webViewSrc' && attributeService.isAffecting(attr, this.noteContext.note))) { this.refresh(); } }