Page MenuHomePhabricator

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

Authored by kamil on Mar 27 2023, 6:27 AM.
Tags
None
Referenced Files
F1680323: D7190.diff
Mon, Apr 29, 6:16 PM
Unknown Object (File)
Sat, Apr 27, 8:14 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:02 AM
Unknown Object (File)
Wed, Apr 3, 8:01 AM
Unknown Object (File)
Wed, Apr 3, 7:55 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
No Lint Coverage
Unit
No Test Coverage

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

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

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

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