-
Hi, first of all, thanks for sharing this app! I've just recently found out about it and it's amazing! I'm working on a widget that's changing app theme. I'm using following SQL query to alter the theme value: After the value is changed, the change is not reflected in the Options / Appearance (it's showing the theme that was active during app start). Trilium has to be closed and reopened (frontend reload is not enough) to reflect the change. I'm running Trilium desktop (v0.60.4 on Windows). I've seen the following discussion regarding syncing: #3586. OP there had issues with Web instance sync, but changes were reflected in Windows client. Regardless, I've tried "Force full sync" and "Fill entity changes records", but without success. I've also tried something like:
(I even tried setting changeId to something different if it makes sense) I couldn't find if the data is cached on app start or assigned to a variable that could be updated on-the-fly. Does anyone know if this is possible (preferably without Frontend reload)? I don't need the reload because the widget's working fine and the UI is altered, it's just that the theme value under Options does not match the current theme. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, updating the database via SQL doesn't notify the application, and the app doesn't constantly re-read everything from DB to see if something changed ... The way to do this would be via backend script API. Unfortunately there isn't an official API for working with options yet, but you can still access it via private API: const themeOption = api.__private.becca.getOption('theme');
themeOption.value = 'your_theme';
themeOption.save(); However, note that specifically theme change needs a frontend reload anyway, since it involves loading new CSS ... |
Beta Was this translation helpful? Give feedback.
Hi, updating the database via SQL doesn't notify the application, and the app doesn't constantly re-read everything from DB to see if something changed ...
The way to do this would be via backend script API.
Unfortunately there isn't an official API for working with options yet, but you can still access it via private API:
However, note that specifically theme change needs a frontend reload anyway, since it involves loading new CSS ...