HomePhabricator
Diffusion Comm 68efff3e6182

[web] Tab sync redux actions

Description

[web] Tab sync redux actions

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

Reviewers: kamil, inka, bartek

Reviewed By: kamil

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D11132

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Feb 21 2024, 5:57 AM
Reviewer
kamil
Differential Revision
D11132: [web] Tab sync redux actions
Parents
rCOMM21231f38fb9e: [web] Proxy tunnelbroker messages to the active tab
Branches
Unknown
Tags
Unknown

Event Timeline

Michal Gniadek <michal.gniadek@swmansion.com> committed rCOMM68efff3e6182: [web] Tab sync redux actions (authored by Michal Gniadek <michal.gniadek@swmansion.com>).Mar 4 2024, 7:14 AM