Page MenuHomePhabricator

[lib] populate community store on user login
Needs RevisionPublic

Authored by ginsu on Feb 26 2024, 1:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 7:56 PM
Unknown Object (File)
Wed, Nov 13, 12:49 PM
Unknown Object (File)
Wed, Nov 13, 12:47 PM
Unknown Object (File)
Oct 12 2024, 3:34 PM
Unknown Object (File)
Oct 12 2024, 3:33 PM
Unknown Object (File)
Oct 12 2024, 3:33 PM
Unknown Object (File)
Oct 3 2024, 6:42 AM
Unknown Object (File)
Oct 3 2024, 4:37 AM
Subscribers

Details

Reviewers
atul
inka
kamil
Summary

When a user logs in to the app we need to populate the community store with all the threads types that return true from threadTypeIsCommunityRoot

Linear task: https://linear.app/comm/issue/ENG-6159/introduce-community-reducer

Depends on D11191

Test Plan

Logged in and out and confirmed that the community store was being populated with the correct communities

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, inka, kamil.
Harbormaster returned this revision to the author for changes because remote builds failed.Feb 26 2024, 1:12 AM
Harbormaster failed remote builds in B27156: Diff 37576!
ginsu requested review of this revision.Feb 26 2024, 1:13 AM

will make sure ci passes before landing

Looks good

lib/reducers/community-reducer.js
43–58

You could do something like following:

const replaceOperations = Object.keys(newThreadInfos).reduce((acc, threadID) => {
  if (threadTypeIsCommunityRoot(newThreadInfos[threadID].type)) {
    const communityInfo = {
      enabledApps: defaultEnabledApps,
    };
    acc.push({
      type: 'replace_community',
      payload: {
        id: threadID,
        communityInfo,
      },
    });
  }
  return acc;
}, []);

(generated with ChatGPT)

that lets us avoid an iteration, but probably doesn't make a difference

This revision is now accepted and ready to land.Feb 26 2024, 2:19 PM
lib/reducers/community-reducer.js
34–38

wondering, shouldn't we also add action.type === fullStateSyncActionType?

lib/reducers/community-reducer.js
34–38

I spoke to @atul about this and from what I understood we don't need this type since the community store is not synced with the keyserver

lib/reducers/community-reducer.js
34–38

But based on the code below, communities are computed based on newThreadInfos which are synced - see here (cc. @atul)

I am afraid that on fullStateSyncActionType we will have inconsistency between threads (threadTypeIsCommunityRoot) and communities in this store

kamil requested changes to this revision.Feb 28 2024, 12:58 AM

Requesting changes because I think it could lead to some issues or if this is okay want to understand it better

This revision now requires changes to proceed.Feb 28 2024, 12:58 AM