Page MenuHomePhabricator

[lib] Introduce aux user store reducer and action types
ClosedPublic

Authored by will on Apr 2 2024, 6:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 10:51 PM
Unknown Object (File)
Fri, Nov 8, 10:12 AM
Unknown Object (File)
Fri, Nov 8, 7:43 AM
Unknown Object (File)
Sun, Nov 3, 1:50 AM
Unknown Object (File)
Oct 25 2024, 6:47 PM
Unknown Object (File)
Oct 24 2024, 8:12 AM
Unknown Object (File)
Oct 24 2024, 7:04 AM
Unknown Object (File)
Oct 24 2024, 5:34 AM
Subscribers

Details

Summary

Introduces the aux user store reducer and fid setter action type

Depends on D11511

Test Plan

Ran the following code

const onPressSave = React.useCallback(async () => {
  dispatch({
    type: setFarcasterFriendsFIDActionType,
    payload: {
      farcasterUsers: [
        {
          userID: 'dispatch_test_userID_1',
          username: 'dispatch_test_username_1',
          farcasterID: 'dispatch_test_farcasterID_1',
        },
      ],
    },
  });
  dispatch({
    type: setFarcasterFriendsFIDActionType,
    payload: {
      farcasterUsers: [
        {
          userID: 'dispatch_test_userID_2',
          username: 'dispatch_test_username_2',
          farcasterID: 'dispatch_test_farcasterID_3',
        },
      ],
    },
  });
  dispatch({
    type: setFarcasterFriendsFIDActionType,
    payload: {
      farcasterUsers: [
        {
          userID: 'dispatch_test_userID_1',
          username: 'dispatch_test_username_1',
          farcasterID: 'dispatch_test_farcasterID_update',
        },
      ],
    },
  });
}, [dispatch]);

Screenshot 2024-04-02 at 9.51.45 PM.png (1×1 px, 325 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will edited the test plan for this revision. (Show Details)
Harbormaster returned this revision to the author for changes because remote builds failed.Apr 2 2024, 6:59 PM
Harbormaster failed remote builds in B27920: Diff 38682!
Harbormaster returned this revision to the author for changes because remote builds failed.Apr 2 2024, 7:10 PM
Harbormaster failed remote builds in B27921: Diff 38683!
will requested review of this revision.Apr 2 2024, 7:16 PM
lib/reducers/aux-user-reducer.js
23 ↗(On Diff #38683)

You can use forEach instead of map. Personally, I'd probably opt for a for-of loop

Overall looks good, just a few comments inline. Going to resign as reviewer so other reviewers can also take a look too

lib/reducers/aux-user-reducer.js
23 ↗(On Diff #38683)

Also .map() is used when we want to creates a new array, which it looks like we don't want to do here

lib/reducers/aux-user-reducer.test.js
9 ↗(On Diff #38683)

Nit: this description is a bit misleading+confusing imo I would say something like "should update aux user store with farcaster data for a user" or something like that

atul requested changes to this revision.Apr 4 2024, 12:17 PM

Back to your queue to replace .map with either for-of loop or forEach

This revision now requires changes to proceed.Apr 4 2024, 12:17 PM

update test description and replace map usage with for-of loop

will marked 3 inline comments as done.Apr 4 2024, 12:46 PM
will planned changes to this revision.Apr 4 2024, 1:08 PM
This revision is now accepted and ready to land.Apr 4 2024, 1:45 PM