obsidian-db-folder icon indicating copy to clipboard operation
obsidian-db-folder copied to clipboard

[FR]: Refresh

Open DannyHatcher-Git opened this issue 2 years ago • 6 comments

Contact Details

No response

Present your request

When I complete a task in the task property it doesn't disappear from view until the database is refreshed. I thought that was a trigger for a refresh.

When a page is added to my vault and should appear in a view it doesn't until I manually refresh the database (via turning on and off the filter or clicking on and off the database page.

For which platform do you request this request??

Desktop

DannyHatcher-Git avatar Oct 10 '22 23:10 DannyHatcher-Git

Due to performance costs, we do not plan to refresh the information in the table once it is loaded. The state is internally self-managed and including a permanent listening today is not feasible.

When we have a solid enough base we will be able to tackle this case

RafaelGB avatar Oct 11 '22 08:10 RafaelGB

That is what I thought, which is why I put in a discussion for a refresh button. I find it very annoying needing to do different actions to just refresh the view. A simple button would make things much easier, and simpler for any end user. Especially when I share videos on YouTube, I get the same comment over and over "how do I refresh the view?"

It was suggested to instead put in issues about when I would want things to be refreshed.

DannyHatcher-Git avatar Oct 11 '22 08:10 DannyHatcher-Git

the enable/disable button of filters triggers that refresh

RafaelGB avatar Oct 11 '22 08:10 RafaelGB

Ok, I think I can work with that. Thanks!

DannyHatcher-Git avatar Oct 11 '22 08:10 DannyHatcher-Git

I will leave this issue open for future automation of refresh =)

RafaelGB avatar Oct 11 '22 08:10 RafaelGB

When pushing the checkbox complete, it would also be nice for that to trigger a refresh if it is included in the filter.

DannyHatcher-Git avatar Oct 11 '22 08:10 DannyHatcher-Git

working on this feature. Currently, it refreshes all the open databases once the application is opened and the Dataview indexing finishes loading.

On the other hand we will use the update capability to listen for changes in other files and thus also update the content.

This last point is already working but I want to improve the performance to avoid redundant or unnecessary calls

RafaelGB avatar Dec 19 '22 06:12 RafaelGB

will update at the file level distinguishing deleted, renamed added or content updates.

ONLY once the index is ready. A restart of Obsidian will be needed

                 /**
		 * When the Dataview index is ready, trigger the index ready event.
		 */
		this.registerEvent(
			this.app.metadataCache.on("dataview:index-ready", async () => {
				// Refresh all database views
				this.viewMap.forEach(async (view) => {
					await view.reloadDatabase();
				});
				/**
				 * Once the index is ready, we can start listening for metadata changes.
				 */
				this.registerEvent(app.metadataCache.on("dataview:metadata-change",
					(type, file, oldPath?) => {
						const activeView = app.workspace.getActiveViewOfType(DatabaseView);
						// Iterate through all the views and reload the database if the file is the same
						this.viewMap.forEach(async (view) => {
							const isActive = activeView && (view.file.path === activeView.file.path);
							view.handleExternalMetadataChange(type, file, isActive, oldPath);
						});
					})
				);
			})
		);

RafaelGB avatar Dec 20 '22 09:12 RafaelGB