Page MenuHomePhabricator

[web-db] implement custom `redux-persist` storage
ClosedPublic

Authored by kamil on Mar 27 2023, 6:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 3:20 AM
Unknown Object (File)
Wed, Nov 6, 3:20 AM
Unknown Object (File)
Tue, Nov 5, 4:41 AM
Unknown Object (File)
Tue, Nov 5, 4:41 AM
Unknown Object (File)
Tue, Nov 5, 4:41 AM
Unknown Object (File)
Tue, Nov 5, 4:41 AM
Unknown Object (File)
Sat, Nov 2, 1:00 AM
Unknown Object (File)
Sat, Nov 2, 12:31 AM
Subscribers

Details

Summary

Custom storage for redux-persist

This diff does not add transition from old to new engine - this is more complicated problem

Depends on D7189, D7186

Test Plan

Update the storage and check if it works properly

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Mar 27 2023, 8:30 AM
ashoat requested changes to this revision.Mar 27 2023, 4:14 PM
ashoat added inline comments.
web/redux/comm-redux-storage-engine.js
7 ↗(On Diff #24210)

Would this be cleaner as an async function?

getItem: async (key: string): Promise<string> => {
  const res = await databaseModule.schedule({
    type: workerRequestMessageTypes.GET_PERSIST_STORAGE_ITEM,
    key,
  });
  if (typeof res?.item !== 'string') {
    throw new Error('Wrong type returned for storage item');
  }
  return res.item;
},
26–55 ↗(On Diff #24210)

Seems like these too can be async functions

This revision now requires changes to proceed.Mar 27 2023, 4:14 PM

use implicit promises

web/redux/comm-redux-storage-engine.js
7 ↗(On Diff #24210)

I tried to explicitly return a promise and match the current web storage interface, but I agree it's cleaner as you suggested

This revision is now accepted and ready to land.Apr 3 2023, 1:59 PM