Page MenuHomePhabricator

[web] Tab sync redux actions
ClosedPublic

Authored by michal on Feb 21 2024, 6:53 AM.
Tags
None
Referenced Files
F3290848: D11132.id37444.diff
Sat, Nov 16, 3:31 PM
F3286386: D11132.diff
Sat, Nov 16, 1:21 PM
Unknown Object (File)
Oct 14 2024, 9:46 PM
Unknown Object (File)
Oct 14 2024, 9:45 PM
Unknown Object (File)
Oct 14 2024, 9:45 PM
Unknown Object (File)
Oct 14 2024, 9:45 PM
Unknown Object (File)
Oct 14 2024, 9:45 PM
Unknown Object (File)
Oct 14 2024, 9:45 PM
Subscribers

Details

Summary

ENG-6660 : Broadcast redux actions

Because only one tab will handle tunnelbroker messages (and we won't have a mechanism like updatesCurrentAsOf for keyserver communication) we need to share the changes with the other tabs. This diffs adds a new redux middleware that send select redux actions to the other tabs, where they are applied.

  • Only the tab broadcasting the action will persist the data to the SQLite, other tabs will skip this
  • Deciding if an action will be synced (and persisted to SQLite) depends on a new dispatchSource field
  • The keyserver actions will continue to work as they currently do

Depends on D11123

Test Plan
  • Add +dispatchSource?: DispatchSource field to UPDATE_DRAFT action
  • Add dispatchSource: 'tunnelbroker' to call to dispatch for drafts
  • Open multiple tabs
  • Make sure that if drafts are modified in one tab, this is reflected in all other tabs
  • Make sure that there is only one db operation dispatched (only one tab should dispatch operations)
  • Make sure that if a new tab is loaded it has the current drafts

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 21 2024, 7:06 AM
Harbormaster failed remote builds in B27033: Diff 37400!
Harbormaster returned this revision to the author for changes because remote builds failed.Feb 22 2024, 7:17 AM
Harbormaster failed remote builds in B27065: Diff 37443!
web/redux/redux-setup.js
468–472 ↗(On Diff #37444)

The reason why there aren't any actions with dispatchSource included in this diff is because they will be added on a case by case basis when implementing data synchronization through tunnelbroker ENG-4730.

web/redux/tab-synchronization.js
25–27 ↗(On Diff #37444)

event.data is typed as mixed. We could introduce a new validator for this the redux actions and use assertWithValidator but there is still an any cast inside and we can assume that messages we get from this channel aren't malicious. So I don't think it's worth it.

This revision is now accepted and ready to land.Mar 4 2024, 6:15 AM
web/redux/redux-setup.js
122–134

Thanks for making these read-only?