The acceptsTableEdit is run on every row. This assumes, that the row belongs to a table, before actually checking if it is part of table.
This actually exposes a faulty behavior in Advanced Tables Obsidian plugin, and noticed in platers/obsidian-lint#827. AT relies on the info provided in the MetadataCache, but by the time the format command is executed, cache is already invalidated. The code in this project implicitly relies on cache, but it doesn't have to.
I think, the correct behavior would be to move this check a bit later, when all the lines that belong to a table already found, and execute acceptsTableEdit on one of the lines. Is there some deeper meaning to the current implementation, that I didn't notice?
When reviewing the sources, I found this statement.
https://github.com/tgrosinger/md-advanced-tables/blob/609c5121b0dc7f7ed0636ce44213155b7e3d8a28/src/table-editor.ts#L1060
The
acceptsTableEdit
is run on every row. This assumes, that the row belongs to a table, before actually checking if it is part of table.This actually exposes a faulty behavior in Advanced Tables Obsidian plugin, and noticed in platers/obsidian-lint#827. AT relies on the info provided in the
MetadataCache
, but by the time the format command is executed, cache is already invalidated. The code in this project implicitly relies on cache, but it doesn't have to.I think, the correct behavior would be to move this check a bit later, when all the lines that belong to a table already found, and execute
acceptsTableEdit
on one of the lines. Is there some deeper meaning to the current implementation, that I didn't notice?