workbench icon indicating copy to clipboard operation
workbench copied to clipboard

BlockMentionsDated fails because block.text is undefined

Open gaqzi opened this issue 3 years ago • 0 comments

Using both Chrome (the desktop app) and Firefox while runnign the following SmartBlock command:

<%BLOCKMENTIONSDATED:20,TODO,7 days ago,today,ASC%>

I get this error:

TypeError: can't access property "toLowerCase", block.text is undefined
    blockMentions timemgmt.js:369
    blockMentionsDated timemgmt.js:479
    textToProcess smartBlocksCmd.js:560
    replaceAsync commonFunctions.js:260
    replaceAsync commonFunctions.js:259
    proccessBlockWithSmartness smartBlocksCmd.js:558
    loopStructure smartBlocks.js:290
    sbBomb smartBlocks.js:395
    blocksToInsert smartBlocks.js:192
    sentryWrapped helpers.ts:87
    setTimeout handler*Sentry</Un</t.prototype.Qt/< trycatch.ts:119
    blocksToInsert smartBlocks.js:191
    value libs.js:32
    enter libs.js:32
    sentryWrapped helpers.ts:87
    setTimeout handler*Sentry</Un</t.prototype.Qt/< trycatch.ts:119
    enter libs.js:32
    value libs.js:32
    value libs.js:32
    sentryWrapped helpers.ts:87
    tn trycatch.ts:185
    ht instrument.ts:559
    value libs.js:32
    value libs.js:32
    value libs.js:32
    scanForNewTextAreas smartBlocks.js:568
    initialize smartBlocks.js:577
    initializeSb main.js:137
    sentryWrapped helpers.ts:87
    setTimeout handler*Sentry</Un</t.prototype.Qt/< trycatch.ts:119
    initializeSb main.js:135
    interval main.js:144
    sentryWrapped helpers.ts:87
    setInterval handler*Sentry</Un</t.prototype.Qt/< trycatch.ts:119
    <anonymous> main.js:128
    <anonymous> main.js:174

I put in a log on the failed block and got out:

Object { uid: "bEEawb_2s", text: undefined }

I can't find an entry in my graph for this uid: July_23rd__2021

I tried cleaning up orphaned blocks, in case that would be why, but that didn't help. I also exported the JSON and had a search for the uid but I didn't find any matches. I'm a bit stumped where this is coming from.

I'm curious if a simple check to ignore blocks with undefined before this would work? The line where the code is going boom: https://github.com/dvargas92495/roam42/blob/b6b71f723c565ec434fed261567f01040e9be7dc/ext/timemgmt.js#L369

Thanks in advance for any help or suggestions for what I can do here! :)

gaqzi avatar Jul 23 '21 15:07 gaqzi