dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.76k stars 259 forks source link

Hooks configured to run onCreate are run when note is refactored #3785

Open Maarrk opened 2 years ago

Maarrk commented 2 years ago

Please select the area your bug applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

Describe the bug

Hooks under onCreate in dendron.yml are run when a note is modified by renaming a note that is referenced within the "hooked" note

To Reproduce

Steps to reproduce the behavior:

  1. Create a hook:
    hooks:
        onCreate:
            -
                id: hello
                pattern: hooked.*
                type: js
module.exports = async function ({ wsRoot, note, NoteUtils, execa, axios, _ }) {
    let d = new Date();
    note.body = `Hello from hook! ${d.toISOString()}`;
    return { note };
};
  1. Restart VS Code to load the hook
  2. Create a note hooked.note
  3. Verify that the note body is "Hello from hook!"
  4. Create a link to other note here, eg. "[[test.note]]"
  5. Visit the link to create the note test.note
  6. Rename test.note using Dendron: Rename Note command
  7. Go back to hooked.note
  8. See that the hook was run again, losing the edits

Expected behavior

Hooks configured to run onCreate are run only when a note is created

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

Additional context

Credits for finding the bug should go to @alatuszam for reporting this bug in a hook gist

Dendron Log file

output of `> Dendron:Dev: Open Logs` ```json {"level":30,"time":1668595712303,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"Logger:configure","msg":"exit","logLevel":"info"} {"level":30,"time":1668595712547,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"_activate","stage":"prod","isDebug":false,"logLevel":"info","logPath":"c:\\Users\\Marek\\AppData\\Roaming\\Code\\logs\\20221116T112001\\window8\\exthost\\dendron.dendron","extensionPath":"c:\\Users\\Marek\\.vscode\\extensions\\dendron.dendron-0.117.0","extensionUri":"c:\\Users\\Marek\\.vscode\\extensions\\dendron.dendron-0.117.0","workspaceFile":"c:\\Users\\Marek\\.dendron\\dendron.code-workspace","workspaceFolders":["c:\\Users\\Marek\\.dendron\\vault"]} {"level":30,"time":1668595712559,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"No cache path for Segment specified. Failed event uploads will not be retried."} {"level":30,"time":1668595712560,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"user telemetry setting: enabled by cli default"} {"level":30,"time":1668595712561,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"telemetry initializing"} {"level":30,"time":1668595712561,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"using existing id"} {"level":30,"time":1668595712561,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"anonymous id","anonymousId":"adjsyutioees7w5xdkjoeja"} {"level":30,"time":1668595712569,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"DendronExtension","msg":"initialized"} {"level":30,"time":1668595712747,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"_activate","msg":"initializeWorkspace","wsType":"CODE","currentVersion":"0.117.0","previousGlobalVersion":"0.117.0","extensionInstallStatus":"NO_CHANGE"} {"level":30,"time":1668595712748,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator.init:postSetupTraits","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595712760,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"runMigrationsIfNecessary","changes":[],"workspaceInstallStatus":"NO_CHANGE"} {"level":30,"time":1668595712760,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator.init:postMigration","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595712769,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator.init:postWsServiceInitialize","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595712777,"pid":11864,"hostname":"marek-win-y700","name":"execServer","state":"enter"} {"level":30,"time":1668595712789,"pid":11864,"hostname":"marek-win-y700","name":"execServer","state":"post:exec.node"} {"level":30,"time":1668595714239,"pid":9428,"hostname":"marek-win-y700","name":"SegmentClient","msg":"No cache path for Segment specified. Failed event uploads will not be retried."} {"level":30,"time":1668595714240,"pid":9428,"hostname":"marek-win-y700","name":"SegmentClient","msg":"user telemetry setting: enabled by cli default"} {"level":30,"time":1668595714241,"pid":9428,"hostname":"marek-win-y700","name":"SegmentClient","msg":"telemetry initializing"} {"level":30,"time":1668595714241,"pid":9428,"hostname":"marek-win-y700","name":"SegmentClient","msg":"using existing id"} {"level":30,"time":1668595714242,"pid":9428,"hostname":"marek-win-y700","name":"SegmentClient","msg":"anonymous id","anonymousId":"adjsyutioees7w5xdkjoeja"} {"level":30,"time":1668595714271,"pid":11864,"hostname":"marek-win-y700","name":"execServer","state":"message","message":"53733"} {"level":30,"time":1668595714272,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"handleServerProcess","msg":"subprocess running","pid":9428} {"level":30,"time":1668595714272,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"startServerProcess","msg":"post-start-server","port":53733,"durationStartServer":1499} {"level":30,"time":1668595714273,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator.init:verifyOrStartServerProcess","port":53733} {"level":30,"time":1668595714280,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator.init:exit"} {"level":30,"time":1668595714290,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"user telemetry setting: enabled by cli default"} {"level":30,"time":1668595714290,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"telemetry initializing"} {"level":30,"time":1668595714290,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"using existing id"} {"level":30,"time":1668595714291,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"anonymous id","anonymousId":"adjsyutioees7w5xdkjoeja"} {"level":30,"time":1668595714291,"pid":11864,"hostname":"marek-win-y700","name":"dendron","msg":"Telemetry is disabled? false"} {"level":30,"time":1668595714291,"pid":11864,"hostname":"marek-win-y700","name":"dendron","msg":"Segment Residual Cache Path is at c:\\Users\\Marek\\AppData\\Roaming\\Code\\User\\globalStorage\\dendron.dendron\\segmentresidualcache.log"} {"level":30,"time":1668595714291,"pid":11864,"hostname":"marek-win-y700","name":"SegmentClient","msg":"Attempting to flush residual segment data from file."} {"level":30,"time":1668595714306,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"_activate:postSetupWorkspace","platform":"win32","extensions":[{"id":"dendron.dendron","version":"0.117.0","active":true},{"id":"dendron.dendron-paste-image","version":"1.1.1","active":false},{"id":"dendron.dendron-markdown-shortcuts","version":"0.12.1","active":true},{"id":"redhat.vscode-yaml","version":"1.10.1","active":false}],"vaults":[{"fsPath":"vault"}]} {"level":30,"time":1668595714309,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.reloadIndex:run","msg":"pre-execute"} {"level":30,"time":1668595714310,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"ReloadIndex.execute","msg":"enter"} {"level":30,"time":1668595714355,"pid":11864,"hostname":"marek-win-y700","name":"dendron","msg":"Segment Residual Cache flush attempted. {\"successCount\":0,\"nonRetryableErrorCount\":0,\"retryableErrorCount\":0}"} {"level":30,"time":1668595714633,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"ReloadIndex.execute","durationEngineInit":320} {"level":30,"time":1668595714634,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"ReloadIndex.execute","msg":"exit"} {"level":30,"time":1668595714634,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.reloadIndex:run","msg":"post-execute"} {"level":30,"time":1668595714651,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"reloadWorkspace","msg":"post-ws.reloadWorkspace"} {"level":30,"time":1668595714652,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"reloadWorkspace","msg":"exit"} {"level":30,"time":1668595714652,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"postReloadWorkspace","msg":"same wsVersion"} {"level":30,"time":1668595714652,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"postReloadWorkspace","msg":"exit"} {"level":30,"time":1668595714653,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"setupViews","msg":"init:treeViewV2"} {"level":30,"time":1668595714653,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"setupBacklinkTreeView","msg":"init:backlinks"} {"level":30,"time":1668595714734,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceActivator:activate","msg":"fin startClient","durationReloadWorkspace":354} {"level":30,"time":1668595714734,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"activateWorkspace","stage":"prod","msg":"enter"} {"level":30,"time":1668595714739,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"togglePluginActiveContext","state":"togglePluginActiveContext: true"} {"level":30,"time":1668595714808,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showWelcomeOrWhatsNew","version":"0.117.0","previousExtensionVersion":"0.91.0"} {"level":30,"time":1668595715800,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupCommand:gatherInput","msg":"enter"} {"level":30,"time":1668595715807,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"LookupControllerV3:new","msg":"enter"} {"level":30,"time":1668595715809,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"prepareQuickPick","msg":"enter"} {"level":30,"time":1668595715813,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"prepareQuickPick","msg":"exit"} {"level":30,"time":1668595715816,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"enter"} {"level":30,"time":1668595715816,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"onUpdatePickerItems:pre"} {"level":30,"time":1668595715816,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"exit"} {"level":30,"time":1668595715838,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider.provide","msg":"enter"} {"level":30,"time":1668595715838,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider.provide","msg":"exit"} {"level":30,"time":1668595715849,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"","profile":13,"numItems":19,"cancelled":false} {"level":30,"time":1668595716290,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"post:queryNotes"} {"level":30,"time":1668595716291,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"engine.query","profile":17} {"level":30,"time":1668595716292,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"h","profile":18,"numItems":50,"cancelled":false} {"level":30,"time":1668595716470,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"post:queryNotes"} {"level":30,"time":1668595716470,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"engine.query","profile":6} {"level":30,"time":1668595716483,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"ho","profile":19,"numItems":4,"cancelled":false} {"level":30,"time":1668595716607,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hoo","profile":17,"numItems":2,"cancelled":false} {"level":30,"time":1668595716888,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hooke","profile":16,"numItems":2,"cancelled":false} {"level":30,"time":1668595717092,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hooked","profile":16,"numItems":2,"cancelled":false} {"level":30,"time":1668595717224,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hooked.","profile":23,"numItems":0,"cancelled":false} {"level":30,"time":1668595717592,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hooked.no","profile":11,"numItems":2,"cancelled":false} {"level":30,"time":1668595718583,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"hooked.note","profile":30,"numItems":2,"cancelled":false} {"level":30,"time":1668595718992,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"quickpick:onDidAccept","msg":"enter","quickpick":"hooked.note"} {"level":30,"time":1668595719004,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.lookupNote:run","msg":"pre-execute"} {"level":30,"time":1668595719005,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupCommand:execute","msg":"enter"} {"level":30,"time":1668595719024,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","msg":"no active doc"} {"level":30,"time":1668595719024,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","msg":"exit","vault":{"fsPath":"vault"}} {"level":30,"time":1668595719049,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","msg":"using webpack require"} {"level":30,"time":1668595719050,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","fpath":"c:\\Users\\Marek\\.dendron\\hooks\\hello.js","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595719059,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595719249,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"]} {"level":30,"time":1668595719252,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595719261,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"enter","fname":"hooked.note"} {"level":30,"time":1668595719265,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"FileWatcher:onDidCreate","fsPath":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595719283,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"LookupControllerV3:onHide","msg":"exit"} {"level":30,"time":1668595719283,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupCommand:execute","msg":"exit"} {"level":30,"time":1668595719284,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.lookupNote:run","msg":"post-execute"} {"level":30,"time":1668595719313,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"exit","fname":"hooked.note"} {"level":30,"time":1668595719318,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595719405,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595722913,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveTextDocument","url":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md","reason":"Manual","msg":"enter"} {"level":30,"time":1668595722931,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveNote","match":["updated: 1668595719025","1668595719025"],"msg":"update activeText editor"} {"level":30,"time":1668595723000,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","msg":"using webpack require"} {"level":30,"time":1668595723000,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","fpath":"c:\\Users\\Marek\\.dendron\\hooks\\hello.js","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595723003,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595723013,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595723935,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595724544,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"provideCompletionItems","position":{"line":9,"character":1},"msg":"enter"} {"level":30,"time":1668595724662,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595724749,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"provideCompletionItems","position":{"line":9,"character":2},"msg":"enter"} {"level":30,"time":1668595724784,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595725729,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveTextDocument","url":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md","reason":"FocusOut","msg":"enter"} {"level":30,"time":1668595725738,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveNote","match":["updated: 1668595722916","1668595722916"],"msg":"update activeText editor"} {"level":30,"time":1668595725801,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","msg":"using webpack require"} {"level":30,"time":1668595725801,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","fpath":"c:\\Users\\Marek\\.dendron\\hooks\\hello.js","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595725804,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595729744,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595729838,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595729934,"pid":11864,"hostname":"marek-win-y700","name":"dendron","msg":"sendSavedAnalytics"} {"level":30,"time":1668595729935,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"AnalyticsUtils.sendSavedAnalytics","message":"start"} {"level":40,"time":1668595729937,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"AnalyticsUtils.sendSavedAnalytics","msg":"failed to read the saved telemetry dir","telemetryDir":"C:\\Users\\Marek\\.dendron\\saved-telemetry"} {"level":30,"time":1668595730010,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595730182,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595730399,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595730741,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595731259,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595734153,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.gotoNote:run","msg":"pre-execute"} {"level":30,"time":1668595734154,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"GotoNoteCommand","opts":{},"msg":"enter"} {"level":30,"time":1668595734168,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","activeDocument":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595734168,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","msg":"exit","vault":{"fsPath":"vault"}} {"level":30,"time":1668595734192,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595734297,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595734297,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595734304,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\test.note.md"]} {"level":30,"time":1668595734307,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595734312,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"enter","fname":"test.note"} {"level":30,"time":1668595734318,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"FileWatcher:onDidCreate","fsPath":"c:\\Users\\Marek\\.dendron\\vault\\test.note.md","msg":"paused"} {"level":30,"time":1668595734325,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"GotoNoteCommand","opts":{"qs":"test.note","vault":{"fsPath":"vault"}},"msg":"exit"} {"level":30,"time":1668595734325,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.gotoNote:run","msg":"post-execute"} {"level":30,"time":1668595734335,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"exit","fname":"test.note"} {"level":30,"time":1668595734345,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\test.note.md"} {"level":30,"time":1668595734417,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595734461,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveTextDocument","url":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md","reason":"FocusOut","msg":"enter"} {"level":30,"time":1668595734471,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onWillSaveNote","match":["updated: 1668595725731","1668595725731"],"msg":"update activeText editor"} {"level":30,"time":1668595734566,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","msg":"using webpack require"} {"level":30,"time":1668595734566,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","fpath":"c:\\Users\\Marek\\.dendron\\hooks\\hello.js","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595734570,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595740935,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595740935,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595740939,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"]} {"level":30,"time":1668595740941,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595740962,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595741035,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":3,"diagnosticsLength":0}} {"level":30,"time":1668595741881,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595741882,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595741886,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\test.note.md"]} {"level":30,"time":1668595741888,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595741909,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\test.note.md"} {"level":30,"time":1668595741978,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595744495,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"LookupControllerV3:new","msg":"enter"} {"level":30,"time":1668595744496,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"prepareQuickPick","msg":"enter"} {"level":30,"time":1668595744496,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"prepareQuickPick","msg":"exit"} {"level":30,"time":1668595744497,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"enter"} {"level":30,"time":1668595744497,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"onUpdatePickerItems:pre"} {"level":30,"time":1668595744497,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"showQuickPick","msg":"exit"} {"level":30,"time":1668595744517,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider.provide","msg":"enter"} {"level":30,"time":1668595744517,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider.provide","msg":"exit"} {"level":30,"time":1668595744518,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"post:queryNotes"} {"level":30,"time":1668595744518,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"engine.query","profile":7} {"level":30,"time":1668595744522,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.note","profile":12,"numItems":1,"cancelled":false} {"level":30,"time":1668595747749,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"post:queryNotes"} {"level":30,"time":1668595747749,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"engine.query","profile":16} {"level":30,"time":1668595747758,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.","profile":25,"numItems":1,"cancelled":false} {"level":30,"time":1668595749337,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"post:queryNotes"} {"level":30,"time":1668595749337,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"createPickerItemsFromEngine","msg":"engine.query","profile":17} {"level":30,"time":1668595749355,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.o","profile":35,"numItems":2,"cancelled":false} {"level":30,"time":1668595749548,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.oth","profile":9,"numItems":1,"cancelled":false} {"level":30,"time":1668595749693,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.othe","profile":21,"numItems":1,"cancelled":false} {"level":30,"time":1668595749789,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.other","profile":0,"numItems":1,"cancelled":false} {"level":30,"time":1668595749981,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.othern","profile":23,"numItems":1,"cancelled":false} {"level":30,"time":1668595750155,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.otherna","profile":28,"numItems":1,"cancelled":false} {"level":30,"time":1668595750253,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.othernam","profile":0,"numItems":1,"cancelled":false} {"level":30,"time":1668595750389,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"NoteLookupProvider:updatePickerItems","msg":"exit","queryOrig":"test.othername","profile":24,"numItems":1,"cancelled":false} {"level":30,"time":1668595750768,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"quickpick:onDidAccept","msg":"enter","quickpick":"test.othername"} {"level":30,"time":1668595750771,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","activeDocument":"c:\\Users\\Marek\\.dendron\\vault\\test.note.md"} {"level":30,"time":1668595750771,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"getVaultForOpenEditor","msg":"exit","vault":{"fsPath":"vault"}} {"level":30,"time":1668595750781,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"move","msg":"changeState.hide event received."} {"level":30,"time":1668595750781,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"LookupControllerV3:onHide","msg":"exit"} {"level":30,"time":1668595750781,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.renameNote:run","msg":"pre-execute"} {"level":30,"time":1668595750781,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"MoveNoteCommand:execute","opts":{"allowMultiselect":false,"useSameVault":true,"title":"Rename Note","moves":[{"oldLoc":{"fname":"test.note","vaultName":"vault"},"newLoc":{"fname":"test.othername","vaultName":"vault"}}],"closeAndOpenFile":true}} {"level":30,"time":1668595750805,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","msg":"using webpack require"} {"level":30,"time":1668595750806,"pid":9428,"hostname":"marek-win-y700","name":"logger","ctx":"requireHook","fpath":"c:\\Users\\Marek\\.dendron\\hooks\\hello.js","wsRoot":"c:\\Users\\Marek\\.dendron"} {"level":30,"time":1668595750848,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksEngineNoteStateChanged"} {"level":30,"time":1668595750936,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595750936,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595750940,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"]} {"level":30,"time":1668595750941,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595750949,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"FileWatcher:onDidCreate","fsPath":"c:\\Users\\Marek\\.dendron\\vault\\test.othername.md","msg":"paused"} {"level":30,"time":1668595750960,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595751072,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595751072,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595751078,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\test.othername.md"]} {"level":30,"time":1668595751081,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595751088,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"enter","fname":"test.othername"} {"level":30,"time":1668595751097,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.renameNote:run","msg":"post-execute"} {"level":30,"time":1668595751111,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"exit","fname":"test.othername"} {"level":30,"time":1668595751114,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\test.othername.md"} {"level":30,"time":1668595751133,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595751180,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595752927,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595752928,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595752932,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"]} {"level":30,"time":1668595752934,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595752959,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\hooked.note.md"} {"level":30,"time":1668595753032,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595754102,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"MoveNoteCommand:execute","msg":"exit"} {"level":30,"time":1668595754179,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595754179,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595754183,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\.dendron\\vault\\test.othername.md"]} {"level":30,"time":1668595754184,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595754207,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeActiveTextEditor","editor":"c:\\Users\\Marek\\.dendron\\vault\\test.othername.md"} {"level":30,"time":1668595754270,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"updateDecorations","msg":"decorating...","payload":{"decorationsLength":2,"diagnosticsLength":0}} {"level":30,"time":1668595772946,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.dev.openLogs:run","msg":"pre-execute"} {"level":30,"time":1668595772947,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"execute","opts":{}} {"level":30,"time":1668595772964,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"dendron.dev.openLogs:run","msg":"post-execute"} {"level":30,"time":1668595773055,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":[]} {"level":30,"time":1668595773056,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595773057,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WindowWatcher:onDidChangeVisibleTextEditors","editorPaths":["c:\\Users\\Marek\\AppData\\Roaming\\Code\\logs\\20221116T112001\\window8\\exthost\\dendron.dendron\\dendron.log"]} {"level":30,"time":1668595773058,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"refreshBacklinksChangeActiveTextEditor"} {"level":30,"time":1668595773060,"pid":11864,"hostname":"marek-win-y700","name":"dendron","ctx":"WorkspaceWatcher:onFirstOpen","msg":"enter","fname":"dendron.log"} ```
Maarrk commented 2 years ago

In case someone else runs into this bug, a way to work around this waiting for the fix could be exiting early at the start of the hook function:

Notes are created empty (but will fail if we want to have more hooks)

if (note.body !== "") {
    return { note };
}

Check that the note is made in the lst second (I typically get ~20ms here, but could fail with extreme lag)

if (Date.now() - note.created > 1000) {
    return { note };
}
jonathanyeung commented 1 year ago

Thanks for filing this issue @Maarrk - I can repro.