HomePhabricator
Diffusion Comm 6004b2a4eaa0

[native] Conditionally retrieve threadInfo from redux store to show newly…

Description

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

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.

Reviewers: atul, ginsu

Reviewed By: ginsu

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8428

Details