super-productivity/docs/wiki
Johannes Millan 3c69aa961e
feat(plugins): fire PERSISTED_DATA_CHANGED hook on persisted-data changes (#7805)
* feat(plugins): fire PERSISTED_DATA_CHANGED hook on persisted-data changes

Wires the dead PluginHooks.PERSISTED_DATA_UPDATE enum into a fired hook,
renamed PERSISTED_DATA_CHANGED. Plugins are notified when their persisted
data changes for any reason after the host's initial boot load — local
writes, remote incremental sync via bulkApplyOperations, and post-boot
wholesale loadAllData paths (SYNC_IMPORT / BACKUP_IMPORT / validation
repair / recovery).

Selector-based effect on selectPluginUserDataFeatureState, gated on
SyncTriggerService.afterInitialSyncDoneAndDataLoadedInitially$ so the
boot-time state seeds the pairwise baseline. Differ compares prev/next
by === on the encoded data blob (never decoded). Stage A composite
entityIds (pluginId:key) are normalized to owner pluginId and deduped
so a plugin with N keyed entries changing in one emission fires exactly
once. Per-pluginId dispatch via new PluginHooksService.dispatchHookToPlugin.

Effect is { dispatch: false } and creates no ops, so no sync-window
guard is needed — and adding one (skipDuringSyncWindow) would silently
suppress the very remote-sync deliveries the hook is designed to catch.

Closes #7754. Follow-up: doc-mode adoption tracked in #7752.

* test(plugins): tighten PERSISTED_DATA_CHANGED spec + docs

Multi-review pass 2 surfaced that the 5s timeout spec asserted only that
the dispatcher resolved — it would have silently passed if the timeout
race were removed entirely. Spy on PluginLog.err and assert the timeout
message actually reached the catch branch.

Also:
- Add `:` guard to PluginHooksService.registerHookHandler so the
  persistence-key grammar is enforced at both the persistence and
  hooks-registry endpoints (defense-in-depth; composeId already throws
  at the bridge).
- Add async-rejected-promise spec to cover the Promise.race branch that
  sync-throw didn't exercise.
- Carry the PERSISTED_DATA_CHANGED contract paragraph into
  docs/plugin-development.md and docs/wiki/3.01-API.md (previously only
  in packages/plugin-api/README.md).
- Clarify loadSyncedData(key?) in the README for keyed plugins.
2026-05-26 23:41:01 +02:00
..
assets docs(wiki): initial revision (v0.1) 2026-01-20 03:04:08 -08:00
0.-Meta-Diataxis.md docs(wiki) v0.2: refactor and populate meta notes (#6134) 2026-01-24 21:14:29 +01:00
0.00-Wiki-Structure-and-Organization.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
0.01-Style-Guide.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
0.02-Wiki-QA-and-Maintenance.md docs(wiki) v0.2: refactor and populate meta notes (#6134) 2026-01-24 21:14:29 +01:00
1.00-Quickstarts.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
1.01-First-Steps.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
1.02-Configure-Data-Synchronization.md fix(sync): support separate Nextcloud login name 2026-05-18 13:43:23 +02:00
2.00-How_To.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.01-Downloads and Install.md docs/wiki content v0.8 (#7068) 2026-04-01 12:40:28 +02:00
2.02-Restore-Data-From-Backup.md docs(wiki): lint headings and lists 2026-02-16 16:23:32 +01:00
2.03-Add-Tasks.md fix(docs): Add documentation for time estimate short syntax (#7454) 2026-05-02 13:57:55 +02:00
2.04-Manage-Subtasks.md docs(wiki): lint headings and lists 2026-02-16 16:23:32 +01:00
2.05-Manage-Scheduled-Tasks.md docs(wiki): lint headings and lists 2026-02-16 16:23:32 +01:00
2.06-Manage-Repeating-Tasks.md docs(wiki): lint headings and lists 2026-02-16 16:23:32 +01:00
2.07-Manage-Task-Integrations.md docs(wiki): lint headings and lists 2026-02-16 16:23:32 +01:00
2.08-Choose-Sync-Backend.md fix(sync): support separate Nextcloud login name 2026-05-18 13:43:23 +02:00
2.09-Configure-Sync-Backend.md fix(sync): support separate Nextcloud login name 2026-05-18 13:43:23 +02:00
2.10-Configure-Obsidian-for-Wiki-Contributions.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.11-Run-the-Development-Server.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.12-Package-the-App.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.13-Run-with-Docker.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.14-Build-for-Android.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.15-Develop-a-Plugin.md fix(plugins): allow iframe-only plugin installs 2026-05-18 13:43:22 +02:00
2.16-Set-Up-Development-Environment.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.17-Add-a-New-Issue-Integration.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
2.18-Contribute-Translations.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
3.00-Reference.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
3.01-API.md feat(plugins): fire PERSISTED_DATA_CHANGED hook on persisted-data changes (#7805) 2026-05-26 23:41:01 +02:00
3.02-Settings-and-Preferences.md feat(theme): add background image blur slider 2026-05-09 18:37:11 +02:00
3.03-Keyboard-Shortcuts.md feat(tasks): copy focused task title with Ctrl/Cmd+C 2026-05-19 22:29:41 +02:00
3.04-Short-Syntax.md docs/wiki content v0.4 (#6257) 2026-01-29 17:35:38 +01:00
3.05-Web-App-vs-Desktop.md Allows to use self-hosted Jira instance without web extension (#7628) 2026-05-21 12:45:26 +02:00
3.06-User-Data.md fix(backups): stop automatic backups when disabled 2026-05-20 17:24:34 +02:00
3.07-Issue-Integration-Comparison.md feat(calendar): add per-provider include/exclude regex filters for iCal events (#7528) 2026-05-11 00:12:01 +02:00
3.08-Sync-Integration-Comparison.md fix(sync): support separate Nextcloud login name 2026-05-18 13:43:23 +02:00
3.09-Theming.md feat(theme): add background image blur slider 2026-05-09 18:37:11 +02:00
3.97-Obsidian-Linter-Config-MD.md docs/wiki content v0.4 (#6257) 2026-01-29 17:35:38 +01:00
3.98-Obsidian-Linter-Config-YAML.md docs/wiki content v0.4 (#6257) 2026-01-29 17:35:38 +01:00
3.99-Other.md docs(wiki) v0.2: refactor and populate meta notes (#6134) 2026-01-24 21:14:29 +01:00
4.00-Concepts.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
4.01-The-Today-View.md docs(wiki): normalize tables and rework ToC 2026-02-04 14:45:00 +01:00
4.02-Inbox-View.md docs/wiki content v0.3 (#6231) 2026-01-28 16:11:22 +01:00
4.03-Planner-View.md docs(wiki): normalize tables and rework ToC 2026-02-04 14:45:00 +01:00
4.04-Schedule-View.md fix(schedule): indicate tasks beyond available time 2026-05-11 14:30:55 +02:00
4.05-Board-View.md docs(wiki): normalize tables and rework ToC 2026-02-04 14:45:00 +01:00
4.06-Project-View.md feat(projects): polish archive flow per #7748 2026-05-23 16:36:04 +02:00
4.07-Tag-View.md docs(wiki): normalize tables and rework ToC 2026-02-04 14:45:00 +01:00
4.07a-Tags_Eat-the-Frog.md docs/wiki content v0.3 (#6231) 2026-01-28 16:11:22 +01:00
4.07b-Tags_Ordinal-Priorities.md docs/wiki content v0.3 (#6231) 2026-01-28 16:11:22 +01:00
4.08-Time-Estimates.md docs(wiki): add How Time Is Logged section 2026-02-04 14:45:00 +01:00
4.09-Task-Attributes.md docs(wiki): substantial addition of integrations (issue and sync) 2026-02-04 14:45:00 +01:00
4.10-Task-Notes.md docs(wiki): add Task Notes 2026-02-04 14:45:00 +01:00
4.11-Subtasks.md docs(wiki): add Repeating Tasks section and update references across multiple documents 2026-02-04 14:45:00 +01:00
4.12-Scheduled-Tasks.md docs(wiki): added Scheduled Tasks; updated references in multiple sections 2026-02-04 14:45:00 +01:00
4.13-Repeating-Tasks.md feat(task-repeat): add repeat after completion option (#7524) 2026-05-10 23:28:22 +02:00
4.14-How-Time-Is-Logged.md docs(wiki): lint style 2026-02-04 14:45:00 +01:00
4.15-Timers-and-Focus-Mode.md feat(focus-mode): auto-start break after manual session completion (#7681) 2026-05-20 15:47:06 +02:00
4.16-Break-Reminders.md docs(wiki): add Reminders and Idle Time 2026-02-04 14:45:00 +01:00
4.17-Idle-Time.md docs(wiki): lint style 2026-02-04 14:45:00 +01:00
4.18-Reflection.md docs(wiki): add Metrics 2026-02-04 14:45:00 +01:00
4.19-Metrics.md docs(wiki): add Metrics 2026-02-04 14:45:00 +01:00
4.20-Task-Archiving.md docs(wiki): add Task Archiving section and update references across multiple documents 2026-02-04 14:45:00 +01:00
4.21-Worklog.md docs(wiki): add new notes for Quick History and Worklog 2026-02-04 14:45:00 +01:00
4.22-Quick-History.md docs(wiki): normalize tables and rework ToC 2026-02-04 14:45:00 +01:00
4.23-Managing-Your-Data.md fix(backups): stop automatic backups when disabled 2026-05-20 17:24:34 +02:00
4.24-Integrations.md Feat/start of next day (#6565) 2026-02-21 12:47:19 +01:00
_Footer.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
_Sidebar.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00
Home.md docs/wiki content v0.7 (#6568) 2026-02-20 21:13:38 +01:00