mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	rename loadresults methods/properties for clarity that they don't contain entities, only rows
This commit is contained in:
		| @@ -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'; | ||||
|   | ||||
							
								
								
									
										1
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -5,7 +5,6 @@ | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "trilium", | ||||
|       "version": "0.60.1-beta", | ||||
|       "hasInstallScript": true, | ||||
|       "license": "AGPL-3.0-only", | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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)) | ||||
|         ) { | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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))) { | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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)) { | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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' | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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' | ||||
|   | ||||
| @@ -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)) { | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -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)) | ||||
|             ) { | ||||
|   | ||||
| @@ -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))) { | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
| @@ -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(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user