obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

[Bug] file.inlinks not working correctly

Open timconnorz opened this issue 3 years ago • 9 comments

The list of file.inlinks is frequently missing items.

Judging from the behavior, it feels that the inlinks are being pulled from some outdated cache or something. When I visit the file and click through to the missing inlinks and then retype the reference link, my dataview query shows the list accurately.

Here's a screenshot showing the behavior: image

And here's a loom video: https://www.loom.com/share/57d03ef53cdd41b7ba87be49ee6038c1

timconnorz avatar May 09 '21 03:05 timconnorz

I can also confirm this.

wenlzhang avatar Jun 16 '21 17:06 wenlzhang

I think I know what this is - I collect all of the links TO a page once when I first index all of the pages, and then I don't update them again unless you change that specific page. If you link to that page somewhere else, it doesn't update file.inlinks unless you change the links explicitly.

blacksmithgu avatar Jun 18 '21 21:06 blacksmithgu

Confirming I've noticed this same issue. Happened to me when I changed the folder for some files: inlinks field suddenly dropped all the links to those files. Have been able to get some of them back by retyping the links as @timconnorz and @blacksmithgu mentioned, but this method seems flaky. Doesn't always work.

Note that Obsidian itself continues to recognize all these links, so it's a dataview thing explicitly

whoisnnamdi avatar Jan 16 '22 21:01 whoisnnamdi

It due to file moves (without renames). Dataview stores links as absolute paths, so if you move a path, the links need to be updated; however, the linking files have no reason to update since their content hasn't changed.

Though mildly inefficient, I'll likely just re-queue the affected files for re-indexing which should resolve this issue, given rename operations aren't that frequent.

blacksmithgu avatar Jan 21 '22 21:01 blacksmithgu

I can confirm this behaviour on Obsidian 0.14.2 and Dataview 0.4.26. I need a table which shows alle pages which have an incoming link from this page.

TABLE WITHOUT ID
	state AS State, 
	file.name AS Lession,
	format, 
	learning_support, 
	last_prod_date,
	note 
FROM "_RMKA/lessions" 
WHERE
contains(file.inlinks, this.file.link)

If I add a link to a note under _RMKA/lessions, it appears in the table. 2022-04-07 16 17 20

I expect the table entry to disappear as soon as I remove the link again, but that is not the case. In my desperation, I also try to do manual edits (in the table note as well as the linked note) to "trigger" something (?): 2022-04-07 16 17 59

The table only refreshes when I close and reopen Obsidian: image

Btw, the incoming link pane of Obsidian always tells the truth and updates on any modification. Any suggestions how to update dataview's cache of inlinks?

Thanks, Simon

simonmeggle avatar Apr 07 '22 14:04 simonmeggle

(Let me know if I can be of any help to debug this)

simonmeggle avatar Apr 08 '22 05:04 simonmeggle

I think adding a manual refresh command could help with this.

AB1908 avatar Apr 10 '22 08:04 AB1908

I reproduced this error, was very weird. Had to quit and restart obsidian for it to update. Anyway to fix this?

craldaz avatar May 20 '22 00:05 craldaz

Does #998 help?

AB1908 avatar May 20 '22 04:05 AB1908