MetaEdit icon indicating copy to clipboard operation
MetaEdit copied to clipboard

Kanban helper function throws error

Open hepabolu opened this issue 3 years ago • 25 comments

When I move a card from lane to lane, the 'status' property is correctly updated, but I get the following error 3x:

MetaEdit (ERROR) 'status not found in <name of kanbanboard>'

I've checked all notes linked from the kanban board but they all have a status property in the metadata section. It sometimes happens when I switch the kanban board from kanban view to edit view to Markdown view and back to kanban view. It's always 3x. I had 3 cards without links, but when I removed 1, the number of errors remained 3.

I've updated to the latest Obsidian version and Kanban and MetaEdit plugin.

hepabolu avatar Oct 03 '21 20:10 hepabolu

Just updated all notes to have a case sensitive match to the list names but the errors remain.

hepabolu avatar Oct 03 '21 20:10 hepabolu

I have the exact same errors. I am using emojies in the status name, maybe that's where the error comes from? Also, it takes several seconds before the error appears and the change is made. Despite the error, the status is correctly changed image

astoicstradingtools avatar Nov 13 '21 16:11 astoicstradingtools

I have the same error. Attaching a video explaining the problem.

https://user-images.githubusercontent.com/78266798/146521398-08240972-d460-4d5e-912f-d0291acaed50.mov

psychsatani avatar Dec 17 '21 09:12 psychsatani

Same here.

wannli avatar Jan 24 '22 01:01 wannli

I'm seeing this as well.

When I see these errors, it also seems like KanbanHelper updates every note in the Kanban. Are other folks seeing that behaviour too? No changes are made, but all the notes get modified (as in, they have a new "date modified" value on the file system).

ryanjamurphy avatar Jan 26 '22 14:01 ryanjamurphy

It seems that the error is being thrown from this line:

https://github.com/chhoumann/MetaEdit/blob/ca75a1e535fb0c97ab211e8c71889819b5db34ea/src/automators/onFileModifyAutomators/kanbanHelper.ts#L67

@chhoumann, could we make that line

log.logWarning(`'${board.property} not found in ${board.boardName} for file ${linkFile.title}'`)

or something similar, to help debug this? Do you want me (or someone) to go through a formal PR to make that change? (Sorry to tag you 😬)

ryanjamurphy avatar Jan 26 '22 16:01 ryanjamurphy

I'm seeing this as well.

When I see these errors, it also seems like KanbanHelper updates every note in the Kanban. Are other folks seeing that behaviour too? No changes are made, but all the notes get modified (as in, they have a new "date modified" value on the file system).

Yes I also felt that it seems to be trying to update everything in vain, including cards that are not notes, so they won't have a status to begin with.

psychsatani avatar Jan 27 '22 05:01 psychsatani

Hey everyone! Thank you for your reports, and apologies for the lack of response. With the merge of #60, this should hopefully be resolved. I haven't been able to recreate the error myself, so I'm leaving this open in case it persists. :)

chhoumann avatar Feb 09 '22 16:02 chhoumann

FWIW, after enabling the error notification I added in the PR mentioned above, I discovered that there were linked notes on the kanban that did not have the YAML property that Kanban Helper was trying to edit. I opened each, added the appropriate property, and now the error is gone.

If you update to the latest version of MetaEdit, you'll see that error notification as well, and it'll let you investigate what the problem is with the notes that are throwing the error.

ryanjamurphy avatar Feb 09 '22 16:02 ryanjamurphy

This issue persists for me even after updating. And it updates properties as a hit or miss.

psychsatani avatar Feb 10 '22 05:02 psychsatani

It is also a hit or miss for me. When I move to my lane named "📝 Todo" or "👨🏻‍💻 Working on it" it updates status but shows an error message (after a very long pause). But when I move to my lane named "✅ Done" or "❌ Dropped" then it throws the same error message but never updates the YAML property.

DandyLyons avatar May 02 '22 21:05 DandyLyons

@psychsatani @DandyLyons The update did not eliminate the error. It just shows an error notification that specifies which notes are causing issues.

All notes on a Kanban board using Metaedit's Kanban Helper must have a metadata key for the Kanban Helper. The Kanban Helper checks and updates every card when any one card is moved. If a card doesn't have the right key, there's nothing to update, and it throws an error.

ryanjamurphy avatar May 03 '22 12:05 ryanjamurphy

I think the problem is more subtle than that. Thanks to the update I can now see which files throw the error and that makes the problem even weirder. My setup: I have 1 Kanban board and all cards on the Kanban board link to a note in a 'projects' folder. Only these notes have a yaml frontmatter field called 'status' which should have the lane as value. None of these notes have a name that starts with a date. Yet MetaEdit complains about notes not having the status field but have names starting with a date. As far as I can tell the names of the files are always the same, but none of them ever appeared on the Kanban board.

Hope this helps.

hepabolu avatar May 14 '22 15:05 hepabolu

@hepabolu Mind screenshotting the error?

It'd also be great if you could share a screenshot of what the console says when this happens. To quote carl in the Discord:

To check for errors, first open the developer tools by pressing Ctrl-Shift-I on Windows/Linux or Cmd-Opt-I on macOS, and then go to the "Console" tab. If you want to save the error to a log file, you can right click on the error and choose "Save as...".

ryanjamurphy avatar May 16 '22 18:05 ryanjamurphy

Sorry for the late reply. I've made a little video that shows the behavior and also shows the console. The video is too big, so I put it here: https://www.dropbox.com/s/8o3h87gyw0wz763/CleanShot%202022-08-06-16-15.mp4?dl=0

As you can see it shows errors about to notes that are not even linked to the kanban note.

hepabolu avatar Aug 06 '22 14:08 hepabolu

@hepabolu Strange. I'm not seeing that behaviour, and all of the errors I ever saw were related to notes that were included on the kanban.

Were the notes that're being reported in the errors ever included on this Kanban? Or is there a chance they're hidden in the source somewhere? Kanban sometimes behaves funny with renamed notes, for instance: it'll use aliasing, such that [[old note name]] will become ``[new note name|old note name]]`, or something (it's not a behaviour I've tried to understand deeply).

ryanjamurphy avatar Aug 08 '22 13:08 ryanjamurphy

The notes were never included on the kanban. The date note also does not match any of the dates of one of the deadlines and the other note was created after the kanban cards were created. I also checked the markdown version of the kanban board and I cannot find anything remotely similar to the notes Metaedit complains about.

Is there a cache somewhere that I could empty and try again?

hepabolu avatar Aug 08 '22 16:08 hepabolu

Is there a cache somewhere that I could empty and try again?

I'm sure there is, but it doesn't sound like it would help. Some more questions:

  1. Do you have other Kanban boards anywhere?
  2. What are the Kanban Helper settings for this board?

ryanjamurphy avatar Aug 08 '22 17:08 ryanjamurphy

Just checked: 1: yes I have one other, with a different name and in a different directory structure in the vault 2: CleanShot 2022-08-10-13-52@2x

This is the board used in the little video.

CleanShot 2022-08-10-12-57@2x

This is the 'work' board in a different directory structure in the vault. FYI: I use the enclosing folder of this Kanban note as a different vault, so I can look at only work-related stuff if necessary.

Both Kanban notes have the same behavior and none of the notes in the error messages are part of the Kanban notes.

hepabolu avatar Aug 10 '22 13:08 hepabolu

Just did a little debugging:

    getLinkFile(link) {
        const markdownFiles = this.app.vault.getMarkdownFiles();
        return markdownFiles.find(f => f.path.includes(`${link.link}.md`));
    }

The return statement also returns files that contain the name of the note. Not just the exact filename. To explain a bit more:

  • the note in the Kanban board is called project1.md
  • this line also finds files like 2022-06-01 project1.md and notes project1.md

The code subsequently tries to update one of the found files which then result in errors.

hepabolu avatar Aug 10 '22 15:08 hepabolu

Another possible suspect is the setting CleanShot 2022-08-10-17-31@2x

I find that MetaEdit throws an error on any daily note that is linked in the Kanban board.

There is an error on 2022-06-01.md and in my Kanban board I have something like

  • [ ] [[Lean]] @[[2022-06-01]]

I also find this line in the console:

MetaEdit: (LOG) 2022-05-23 is not updatable for the KanbanHelper.

2022-05-23.md is a note that does not exist but it is part of a line in the Archive part of the Kanban board:

  • [x] 2022-08-10 16:54 -- [[project1]] @[[2022-05-23]]

Hope this helps

hepabolu avatar Aug 10 '22 15:08 hepabolu

Interesting! I think you found the two sources of these issues...

Would you consider submitting a PR for a fix? 😄

ryanjamurphy avatar Aug 10 '22 18:08 ryanjamurphy

Well, I'm not sure how to solve the problems, but I can look into it.

hepabolu avatar Aug 11 '22 07:08 hepabolu

I've proposed a fix for one of the issues: see PR #79. I have no idea how to solve the second problem. I assume you would need to restrict the links to be considered to those immediately following a task notation and preferably skip those in the Archive section, but I have no clue how to code that.

hepabolu avatar Aug 13 '22 09:08 hepabolu

#80 has a code snippet that probably solves the second problem.

hepabolu avatar Sep 11 '22 18:09 hepabolu

:tada: This issue has been resolved in version 1.8.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Jul 30 '23 19:07 github-actions[bot]

Hey everyone! Thanks for the contributions here! Sorry for being so slow to respond. I've merged the PR + made some additional fixes myself. Please let me know if the issue is resolved! :)

chhoumann avatar Jul 30 '23 19:07 chhoumann