Page MenuHomePhabricator

[native] Conditionally retrieve threadInfo from redux store to show newly created roles
ClosedPublic

Authored by rohan on Jul 5 2023, 10:43 AM.
Tags
None
Referenced Files
F2057438: D8428.id29382.diff
Thu, Jun 20, 3:34 PM
Unknown Object (File)
Wed, Jun 12, 10:49 PM
Unknown Object (File)
Wed, Jun 12, 4:22 PM
Unknown Object (File)
Tue, Jun 11, 9:45 PM
Unknown Object (File)
Tue, Jun 11, 1:26 PM
Unknown Object (File)
Tue, Jun 11, 5:59 AM
Unknown Object (File)
Mon, Jun 10, 4:41 AM
Unknown Object (File)
Sun, Jun 9, 4:30 PM
Subscribers

Details

Summary

Currently, when a new role is created and the navigation.goBack() call is made to go from the create-roles-screen to the community-roles-screen, the newly created role will not show up until the screen is closed out of and re-opened. This is because while the threadInfo is successfully updated, the react navigation params containing the threadInfo are not updated. The solution to this is to run a useEffect hook that will pull in the threadInfo from the redux store, if it exists (this will be up to date). This is a solution that is done in thread-settings.react.js.

Separately, the addition of CommunityRolesScreenRouteName to threadRoutes is because we want to consider for the possibility of someone deleting the community while someone is creating a role - in this case, we'd like to use the existing ThreadScreenPruner to alert the user that they no longer can view the community. The pruner calls getThreadIDFromRoute. This function takes in a routes parameter that defaults to threadRoutes.

Depends on D8422

Test Plan

Confirmed that when a new role is created, the community-roles screen is now updated to reflect the new role in the list of available community roles.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rohan requested review of this revision.Jul 5 2023, 10:59 AM

Looks good, but just want to clarify my understanding of your last point in the summary:

By adding CommunityRolesScreenRouteName to the threadRoutes array, we are able to address this edge case of someone deleting the community while someone else is creating a role "for free" since ThreadScreenPruner will show a popup alerting the user that "they no longer can view the community" in all the routes that are in threadRoutes

This revision is now accepted and ready to land.Jul 11 2023, 4:40 PM
In D8428#250060, @ginsu wrote:

By adding CommunityRolesScreenRouteName to the threadRoutes array, we are able to address this edge case of someone deleting the community while someone else is creating a role "for free" since ThreadScreenPruner will show a popup alerting the user that "they no longer can view the community" in all the routes that are in threadRoutes

Yeah exactly, this was my understanding as well after my 1:1