Skip to content
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

Improve performance: Stop Tasks Plugin from Running on Inactive Tabs #2999

Open
4 tasks done
ma-sadeghi opened this issue Jul 31, 2024 · 3 comments
Open
4 tasks done
Labels
priority: high A high priority/important request scope: performance issues Issues with speed or responsiveness type: enhancement New feature or request

Comments

@ma-sadeghi
Copy link

⚠️ Please check that this feature request hasn't been suggested before.

  • I searched previous Ideas in Discussions didn't find any similar feature requests.
  • I searched previous Issues didn't find any similar feature requests.
  • I am only requesting a single feature. Multiple changes should be split into individual requests, with links between them.
  • I believe my requested feature will be generally applicable to other users, not just me: it is not uniquely tied to my personal workflow.

🔖 Feature description

When multiple tabs are open (some with and some without task queries), the Tasks plugin seems to be running in the background even when the active tab doesn't contain any task queries. This makes Obsidian choppy, which is noticeable when typing.

✔️ Solution

One possible solution could be to stop the Tasks plugin from running in the background on tabs that are not active. This could help in reducing the choppiness and improve the overall performance of Obsidian.

❓ Alternatives

An alternative is to limit the plugin's activity to only the active tab or to provide an option to manually refresh task queries as needed.

📝 Additional Context

No response

@ma-sadeghi ma-sadeghi added the type: enhancement New feature or request label Jul 31, 2024
@claremacrae claremacrae added the scope: performance issues Issues with speed or responsiveness label Aug 1, 2024
@claremacrae
Copy link
Collaborator

claremacrae commented Aug 1, 2024

Thanks for logging this.

Notes for future implementation:

  • What's the Obsidian API for:
    • detecting if a code block is in a visible/shown note?
    • detecting when a code block becomes not shown?
    • detecting when a code block becomes shown?
      • this is the most critical bit
      • failure to detect that a query should be redrawn is the most serious mode of failure of any implementation of this, as it would then show potentially out-of-date results
  • Scenarios that must be implemented - Tasks code blocks in...:
    • Reading Mode
    • Live Preview
    • Notes in side-bars
  • Nice-to-have scenarios that might be considered - Tasks code blocks in...:
    • Collapsed Callouts
      • Need to track when the callout is collapsed and expanded
    • Machine-generated code-blocks (that are created in other code blocks such as dataviewjs and js-engine)
      • Tasks doesn't know if its query was machine-generated...
      • But if it the query was machine-generated, then the shown/hidden state of the parent code blocks is what matters
    • Tabs plugin tabs

@claremacrae claremacrae added the priority: high A high priority/important request label Aug 4, 2024
@claremacrae
Copy link
Collaborator

It's possible that this will just be fixed from Obsidian 1.7.2 (Insider) and onwards...
I need to do some more testing, but Obsidian is now doing work to not render hidden views:
https://docs.obsidian.md/Plugins/Guides/Understanding+deferred+views

@claremacrae
Copy link
Collaborator

claremacrae commented Sep 21, 2024

No. Reply from Liam in Discord:

no, views are only deferred on initial load, once a tab has been loaded, it will continue to run. You'll need to handle this case yourself at the view level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high A high priority/important request scope: performance issues Issues with speed or responsiveness type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants