Page MenuHomePhabricator

[lib] introduce useJoinCommunity
ClosedPublic

Authored by ginsu on Jul 9 2024, 9:49 AM.
Tags
None
Referenced Files
F3570760: D12706.diff
Sat, Dec 28, 6:19 AM
Unknown Object (File)
Sun, Dec 22, 6:49 PM
Unknown Object (File)
Sun, Dec 22, 6:49 PM
Unknown Object (File)
Sun, Dec 22, 6:49 PM
Unknown Object (File)
Sun, Dec 22, 6:49 PM
Unknown Object (File)
Sun, Dec 22, 6:49 PM
Unknown Object (File)
Sun, Dec 22, 6:48 PM
Unknown Object (File)
Sun, Dec 22, 6:48 PM
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 ↗(On Diff #42218)

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.