Page MenuHomePhabricator

[lib/native/web] introduce synced metadata reducer
ClosedPublic

Authored by will on Mar 27 2024, 4:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 4:44 AM
Unknown Object (File)
Wed, Nov 13, 12:34 AM
Unknown Object (File)
Tue, Nov 12, 10:08 PM
Unknown Object (File)
Thu, Nov 7, 11:32 PM
Unknown Object (File)
Oct 22 2024, 2:46 PM
Unknown Object (File)
Oct 22 2024, 2:46 PM
Unknown Object (File)
Oct 22 2024, 2:46 PM
Unknown Object (File)
Oct 22 2024, 2:46 PM
Subscribers

Details

Summary

Introduces the synced metadata reducer which handles replace, remove, and remove all ops.

Depends on D11421

Test Plan

Ran the following code:

const onPressSave = React.useCallback(async () => {
  dispatch({
    type: addSyncedMetadataEntryActionType,
    payload: {
      name: 'Test_1_name',
      data: 'Test_1_data',
    },
  });

  dispatch({
    type: addSyncedMetadataEntryActionType,
    payload: {
      name: 'Test_2_name',
      data: 'Test_2_data',
    },
  });

  dispatch({
    type: addSyncedMetadataEntryActionType,
    payload: {
      name: 'Test_1_name',
      data: 'Test_1_update',
    },
  });

  dispatch({
    type: removeSyncedMetadataEntryActionType,
    payload: {
      name: 'Test_2_name',
    },
  });
}, [dispatch]);

Screenshot 2024-03-27 at 8.07.39 PM.png (778×848 px, 139 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will requested review of this revision.Mar 27 2024, 4:33 PM
will planned changes to this revision.Mar 27 2024, 5:05 PM

add support for the remove synced metadata action type

kamil requested changes to this revision.Mar 28 2024, 5:04 AM

LGTM - requesting changes to address this blacklist comment because this is important

lib/reducers/synced-metadata-reducer.js
14 ↗(On Diff #38405)
30–33 ↗(On Diff #38405)
lib/types/redux-types.js
165 ↗(On Diff #38405)

This will be persisted only on SQL database so you should add this to persistBlacklist.

Because there is no migration (and no need to do it) you should've seen alerts with EXPECTED KEYS NOT REHYDRATED.

Separately - this started to be annoying, we have blacklist on native and whitelist on the web and it's easy to oversight this - could you create a follow-up task to address it anytime in the future?

This revision now requires changes to proceed.Mar 28 2024, 5:04 AM
will marked 2 inline comments as done.Mar 28 2024, 4:56 PM
lib/types/redux-types.js
165 ↗(On Diff #38405)

Included as part of blacklist in latest rebase.

Created the follow-up task on linear: https://linear.app/comm/issue/ENG-7602/rethink-redux-persist-blacklist-and-native-whitelist

Left a question on what I should put as the parent

This revision is now accepted and ready to land.Apr 2 2024, 1:34 AM