mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	fixes
This commit is contained in:
		| @@ -294,7 +294,7 @@ function getHashValueFromAddress() { | ||||
| async function loadTreeData() { | ||||
|     const resp = await server.get('tree'); | ||||
|  | ||||
|     treeCache.load(resp.notes, resp.branches); | ||||
|     treeCache.load(resp.notes, resp.branches, resp.attributes); | ||||
|  | ||||
|     return await treeBuilder.prepareTree(); | ||||
| } | ||||
|   | ||||
| @@ -1,8 +1,7 @@ | ||||
| import Branch from "../entities/branch.js"; | ||||
| import NoteShort from "../entities/note_short.js"; | ||||
| import ws from "./ws.js"; | ||||
| import server from "./server.js"; | ||||
| import Attribute from "../entities/attribute.js"; | ||||
| import server from "./server.js"; | ||||
|  | ||||
| /** | ||||
|  * TreeCache keeps a read only cache of note tree structure in frontend's memory. | ||||
| @@ -127,7 +126,7 @@ class TreeCache { | ||||
|     async reloadNotes(noteIds) { | ||||
|         const resp = await server.post('tree/load', { noteIds }); | ||||
|  | ||||
|         this.addResp(resp.notes, resp.branches); | ||||
|         this.addResp(resp.notes, resp.branches, resp.attributes); | ||||
|  | ||||
|         for (const note of resp.notes) { | ||||
|             if (note.type === 'search') { | ||||
| @@ -152,7 +151,7 @@ class TreeCache { | ||||
|                 })); | ||||
|  | ||||
|                 // update this note with standard (parent) branches + virtual (children) branches | ||||
|                 treeCache.addResp([note], branches); | ||||
|                 treeCache.addResp([note], branches, []); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @@ -167,7 +166,7 @@ class TreeCache { | ||||
|  | ||||
|         return noteIds.map(noteId => { | ||||
|             if (!this.notes[noteId] && !silentNotFoundError) { | ||||
|                 ws.logError(`Can't find note "${noteId}"`); | ||||
|                 console.log(`Can't find note "${noteId}"`); | ||||
|  | ||||
|                 return null; | ||||
|             } | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| import utils from './utils.js'; | ||||
| import toastService from "./toast.js"; | ||||
| import server from "./server.js"; | ||||
| import appContext from "./app_context.js"; | ||||
|  | ||||
| const $outstandingSyncsCount = $("#outstanding-syncs-count"); | ||||
|  | ||||
| @@ -133,6 +132,8 @@ async function consumeSyncData() { | ||||
|         const outsideSyncData = allSyncData.filter(sync => sync.sourceId !== glob.sourceId); | ||||
|  | ||||
|         try { | ||||
|             const appContext = (await import("./app_context.js")).default; | ||||
|  | ||||
|             // the update process should be synchronous as a whole but individual handlers can run in parallel | ||||
|             await Promise.all([ | ||||
|                 () => appContext.trigger('syncData', {data: allSyncData}), | ||||
|   | ||||
| @@ -560,7 +560,7 @@ export default class NoteTreeWidget extends TabAwareWidget { | ||||
|         }); | ||||
|  | ||||
|         if (noteIdsToRefresh.size > 0) { | ||||
|             appContext.trigger('reloadNotes', {noteIds: Array.from(noteIdsToRefresh)}); | ||||
|             this.appContext.trigger('reloadNotes', {noteIds: Array.from(noteIdsToRefresh)}); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,7 @@ const sql = require('../../services/sql'); | ||||
| const optionService = require('../../services/options'); | ||||
| const treeService = require('../../services/tree'); | ||||
|  | ||||
| async function getNotesAndBranches(noteIds) { | ||||
| async function getNotesAndBranchesAndAttributes(noteIds) { | ||||
|     noteIds = Array.from(new Set(noteIds)); | ||||
|     const notes = await treeService.getNotes(noteIds); | ||||
|  | ||||
| @@ -45,20 +45,10 @@ async function getNotesAndBranches(noteIds) { | ||||
|         FROM attributes | ||||
|         WHERE isDeleted = 0 AND noteId IN (???)`, noteIds); | ||||
|  | ||||
|     for (const {noteId, type, name, value, isInheritable} of attributes) { | ||||
|         const note = noteMap[noteId]; | ||||
|  | ||||
|         note.attributes.push({ | ||||
|             type, | ||||
|             name, | ||||
|             value, | ||||
|             isInheritable | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     return { | ||||
|         branches, | ||||
|         notes | ||||
|         notes, | ||||
|         attributes | ||||
|     }; | ||||
| } | ||||
|  | ||||
| @@ -80,11 +70,11 @@ async function getTree() { | ||||
|  | ||||
|     noteIds.push('root'); | ||||
|  | ||||
|     return await getNotesAndBranches(noteIds); | ||||
|     return await getNotesAndBranchesAndAttributes(noteIds); | ||||
| } | ||||
|  | ||||
| async function load(req) { | ||||
|     return await getNotesAndBranches(req.body.noteIds); | ||||
|     return await getNotesAndBranchesAndAttributes(req.body.noteIds); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user