Skip to content

feat: Provide user-configuration for folders to update on any modifications #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevenwcarter
Copy link
Contributor

This change provides a user-configuration for folders to "force update" on any unrelated modification. This is useful for scenarios where files that contain queries need to be update more frequently. The command palette will still update all notes as before.

@stevenwcarter
Copy link
Contributor Author

Related to comment on #27

@dsebastien
Copy link
Owner

Good addition. I'll update the documentation of the plugin accordingly.

Actually I've just noticed that my Obsidian vault is constantly updating dataview queries since I've released the new version. So I guess that some of the safeguards I had put in place were really useful to prevent such scenarios. My hunch is that the delay between two full updates is too short with my 10K+ notes vault, so a new run is started before the previous had time to complete

@stevenwcarter
Copy link
Contributor Author

Yes, I had noticed the same thing. In my case, it was a single query in a file from 18 months ago that was causing it. That file was getting a constantly updated result from the query, so it would enter an update loop. I realized that I didn't need every file to be updated constantly, but still wanted the ability to trigger a global update of all files.

I removed that misbehaving query and things quieted down for me. I temporarily added a console log on the modified event, so I could see which file was being updated each run, kicking off the duplicative runs. I agree that there still might need to be some checking, like preventing the same files from being updated that were just updated/modified from the previous run. That would keep duplicative runs to a minimum.

My vault has probably 4-5k queries using this new format now, and it's been performing well with the updates I provided. This also feels like a better change because users would need to opt into the updated behavior by updating their configuration.

@dsebastien
Copy link
Owner

I'll delay this until we have an implementation of #29 that does not cause #30

@stevenwcarter
Copy link
Contributor Author

It was #28 that caused the regression. This change fixes the regression, and makes the full vault update on file modifications an opt-in behavior instead. Plus, users can opt in just with particular directories that they want to have updated regularly. In my case, I really only needed the immediate update on a single directory that contains my index document. (It contains the results of queries which point to files that I need to review in my workflow, and should be updated more often)

@stevenwcarter
Copy link
Contributor Author

stevenwcarter commented Nov 26, 2024

Also for reference, the query that was causing the constant updates was this:

TABLE WITHOUT ID this, this.date WHERE file = this.file

I had been using this as a test when figuring out some dataview query behavior a while back and forgotten about it. Since the output includes a dynamic value (this) it always appeared like a different result, since on save the last modified timestamp is being modified in my vault. I think the only way to prevent that would be to calculate the serialized query twice, and compare them to ensure they are identical. If not, log a warning and refuse to update the serialized query. The serialized queries should be idempotent for this use-case.

…ation

This change provides a user-configuration for folders to "force update" on
any unrelated modification. This is useful for scenarios where files that
contain queries need to be update more frequently. The command palette
will still update all notes as before.
@stevenwcarter stevenwcarter force-pushed the feature/configurable-unrelated-updates branch from 21a961f to 5e46231 Compare November 26, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants