Page MenuHomePhabricator

[lib] introduce useJoinCommunity
ClosedPublic

Authored by ginsu on Jul 9 2024, 9:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 5:17 PM
Unknown Object (File)
Mon, Nov 11, 1:15 AM
Unknown Object (File)
Sun, Nov 10, 11:07 PM
Unknown Object (File)
Sun, Nov 10, 11:51 AM
Unknown Object (File)
Sat, Nov 9, 10:29 PM
Unknown Object (File)
Fri, Nov 8, 10:39 PM
Unknown Object (File)
Fri, Nov 8, 7:14 AM
Unknown Object (File)
Fri, Nov 8, 7:14 AM
Subscribers

Details

Summary

Move diff. This diff introduces useJoinCommunity. useJoinCommunity factors out the shared logic between joining a community through accepting an invite link and joining a community through the auto join community handler. Subsequent diffs will handle making useJoinCommunity more agnostic so that the hook can be used at both callsites

Depends on D12702

Test Plan

flow + confirmed that there were no regressions with the joining a community through accepitng an invite link user flow

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/shared/community-utils.js
281 ↗(On Diff #42147)

The change here is that we set threadID to the threadID hook param rather than verificationResponse.thread?.id

334 ↗(On Diff #42147)

The changes here are because we already declared threadID in the upper scope as a hook param, so we needed a new variable name here

ginsu requested review of this revision.Jul 9 2024, 10:05 AM

Didn't review the code closely since it's marked as a move diff

I think it would be good to lift the state back into the component

lib/hooks/invite-links.js
187 ↗(On Diff #42147)

Rather than having useJoinCommunity create the state and pass it back out, I think it would be more readable for this component to create the state and then pass it in

In general, it's best to have state "lifted" to the shared common ancestor

This revision is now accepted and ready to land.Jul 9 2024, 11:06 AM
lib/shared/community-utils.js
366–415

Realized that I also should have this effect in useJoinCommunity. Updated the diff to address this

This revision was landed with ongoing or failed builds.Jul 11 2024, 9:01 PM
This revision was automatically updated to reflect the committed changes.