Hooks for addition, removal, or modifications of note types and decks?

Hi! In my Sonaveeb Integration addon I populate some drop-down lists with existing decks and valid note types at launch. I would like to keep those lists up-to-date when decks or note types are added, removed, renamed, or in case of note types - modified. Is there an easy way to detect when such changes occur?

I see there are hooks deck_added and note_type_added, but they are marked as obsolete, and I can’t find anything for removal or modifications anyway.

1 Like

I populate some drop-down lists with existing decks and valid note types at launch.

You only fetch the existing decks and note types for the dropdowns once at startup? There’s no need to be so stingy with processing. Database queries are quite fast on desktop.

The solution to always showing up-to-date data would be to perform the query to get the decks and note types every time the modal dialog containing your dropdown is about to be displayed.

Unless… your dropdown is in the main window and always displayed? In that case, I guess you’d set up some triggers to detect when the user has focused on the main window and repopulate the dropdown then. I think this should be possible by listening to some event on the main window. Probably event.gotFocus()?

2 Likes

Thank you! My dropdown is in a separate dialog window, but to make sure it’s always reliably up-to-date I guess I would still need to handle my dialog window focus event, and not just visibility changes, otherwise it won’t update while the dialog is open. But it sounds good anyway, I’ll try it. Thanks again!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.