Page MenuHomePhabricator

[web] Persist enabled apps using default storage engine
ClosedPublic

Authored by tomek on Aug 11 2022, 9:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 27, 12:40 PM
Unknown Object (File)
Mon, Jun 24, 7:52 AM
Unknown Object (File)
Thu, Jun 20, 5:22 AM
Unknown Object (File)
Sat, Jun 15, 8:02 PM
Unknown Object (File)
May 27 2024, 1:51 AM
Unknown Object (File)
May 27 2024, 1:51 AM
Unknown Object (File)
May 27 2024, 1:46 AM
Unknown Object (File)
May 21 2024, 7:08 PM

Details

Summary

Persist only one property of the state - enabledApps. The persistence uses the default storage engine - localStorage. There are a couple of other options https://github.com/rt2zz/redux-persist#storage-engines, including indexedDB, but for our needs the default one should be good enough.

Depends on D4811 D4848

Test Plan

Run the web app, choose enabled apps and refresh the page - the selection should remain. Open debugger and check application tab -> local storage: there should be a single entry associated with localhost that contains an object with enabledApps and _persist keys.

To test if the state is cleared, I disabled calendar, logged out and in and checked if calendar is enabled - just like in defaultWebEnabledApps.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul added a reviewer: ashoat.

Looks good to me, adding @ashoat as blocking since I think he has additional context and this is a consequential change

This revision is now accepted and ready to land.Aug 11 2022, 10:03 PM

One remaining part is handling cleaning the data when logging out - I created a task https://linear.app/comm/issue/ENG-1604/clean-enabled-apps-on-logout to handle it. We can also consider having a mechanism which clears the whole persisted state on logout.

This diff got rebased on top of D4848 which contains state cleanup on logout.