In $:/core/modules/startup/render.js
, there’s an event listener for a “change” event, which seems to be triggered by any click on any link or widget or keypress in any field.
If I understand correctly, this is then forwarded to update all open and non-folded tiddlers, which means all macros, widgets, filters, transclusions etc? I don’t understand exactly how this works, and am not sure if this triggers saves as well.
I’m getting delays of 100-300 ms for every single click or keypress if I open a few large tiddlers (40 ms otherwise), and to me it seems unnecessary in most cases. Some examples:
- When clicking “edit this tiddler”
- When opening or closing dropdown menus
- When editing a draft’s tags or fields
- When navigating in the sidebar
- When clicking tiddler links
- When clicking the empty search box
- For every single keypress in the search box
First I thought a simple “debounce” would suffice – as in “Defer the change if only drafts have changed”, but for all changes. This works for typing and searching, since you don’t expect or need to see the effects of the changes right away. But for clicking links, it’s a no-go, since you expect links to open immediately.
An improvement would be to handle tags and fields of drafts (and the search box) the same way the texts of drafts are handled.
But I have a hard time understanding why all tiddlers must be updated in all the cases listed above.
Thoughts?