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)
Tue, Apr 9, 7:33 PM
Unknown Object (File)
Sat, Apr 6, 3:21 PM
Unknown Object (File)
Sat, Apr 6, 11:08 AM
Unknown Object (File)
Sat, Apr 6, 9:37 AM
Unknown Object (File)
Wed, Apr 3, 1:23 AM
Unknown Object (File)
Wed, Apr 3, 1:23 AM
Unknown Object (File)
Tue, Apr 2, 9:13 PM
Unknown Object (File)
Tue, Apr 2, 2:43 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.Thu, Mar 28, 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.Thu, Mar 28, 5:04 AM
will marked 2 inline comments as done.Thu, Mar 28, 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.Tue, Apr 2, 1:34 AM