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)
Tue, Nov 19, 11:10 PM
Unknown Object (File)
Tue, Nov 5, 8:44 AM
Unknown Object (File)
Tue, Nov 5, 8:44 AM
Unknown Object (File)
Tue, Nov 5, 8:44 AM
Unknown Object (File)
Tue, Nov 5, 8:43 AM
Unknown Object (File)
Oct 24 2024, 7:59 AM
Unknown Object (File)
Oct 10 2024, 4:43 AM
Unknown Object (File)
Sep 13 2024, 7:57 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.