question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug report: task implicit `tags` field detects erroneous items that follow `#` symbol but are not tags, `file.tags` correctly follows Obsidian behavior on same items

See original GitHub issue

What happened?

The implicit tags field on Tasks incorrectly parses some items that follow a # symbol but are not tags, such as the color in <mark style="background: #FFF3A3A6;">, as tags, in operations such as GROUP BY tags. Obsidian does not recognize these items as tags, so dataview should not either. In fact, if using GROUP BY file.tags instead, the behavior is correct and no erroneous tags are invented, so the parsing error is specific to the implicit tags field on tasks. Does file.tags use some Obsidian API for getting tags that a task’s tags field does not?

Found thanks to @claremacrae investigation of a similar issue in the Tasks plugin: https://github.com/obsidian-tasks-group/obsidian-tasks/issues/929 Related: #1268 seems to find the same issue with dataviewjs.

DQL

Test case (found by @claremacrae on obsidian-tasks, wrapped in codeblock to display correctly on Github, remove the codeblock when copying)

- [ ] <mark style="background: #FFF3A3A6;">Make phone call 10:50 today</mark>
- [ ] [Enable preview feature #678](https://github.com/obsidian-tasks-group/obsidian-tasks)
- [ ] [Internal: Better abstraction for grouping of tasks · Discussion #920 · obsidian-tasks-group/obsidian-tasks · GitHub](https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/920)

Incorrect results (test case above is grouped by erroneous items following # that are not tags)

TASK
FROM "path/To/Test/File"
GROUP BY tags

Correct results (all in same group, no tags)

TASK
FROM "path/To/Test/File"
GROUP BY file.tags

JS

/* https://github.com/blacksmithgu/obsidian-dataview/issues/1268 Issue # 1268 seems to have repro this in JS also. I did not test JS. */

Dataview Version

0.5.41

Obsidian Version

0.15.8

OS

Windows

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
claremacraecommented, Aug 7, 2022

It was indeed easier to do per-task matching then to traverse the tags array for positions. Will see if I can swap to using the Obsidian cache instead.

Hi @blacksmithgu - just to suggest a possibly easier alternative that I think would give a pretty good result.

If you can pass file.tags in to the code that parses the task line, then that code could intersect the tags it found in the line with the tags in the file, and only keep in the Task the tags that are in both lists.

There could be some very rare cases where a tag elsewhere in the file matches a not-tag in the line, but speaking personally, in the Tasks plugin, I would take a simple fix like this, that’s easy to write and review and release, over a rewrite at this point. So I wanted to suggest it to you too.

1reaction
blacksmithgucommented, Aug 6, 2022

It was indeed easier to do per-task matching then to traverse the tags array for positions. Will see if I can swap to using the Obsidian cache instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Search by task-todo and tag not working correctly
This is the correct behaviour. Tag uses page level match. task-todo: uses a block level match. Your workaround is not a workaround but...
Read more >
Dataview parse error if tag contains some special charaters
If I wrote a dv snippet to query a tag wihich contains some special charaters, like "." or "·" or "&" etc., dv...
Read more >
Release Notes | Rock RMS
Rock McKinley 14.0 fixes issues that were reported during the previous release(s) and introduces a variety of new features including content "personalization", ...
Read more >
Subjects Covered (OCM) - Human Relations Area Files
Murdock in the 1940s, is an ethnographic classification system on human behavior, social life and customs, material culture, and human-ecological environments.
Read more >
All changes - LiveAgent Changelog
[Fix] Multi KB edit configuration override incorrect behavior (#14085) ... Remove collapsing of tags in ticket grid in Material and Obsidian (#13707) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found