Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix join workspace flow #39991

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceJoinUserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ function WorkspaceJoinUserPage({route, policy}: WorkspaceJoinUserPageProps) {
}, []);

useEffect(() => {
if (!policy || isUnmounted.current || isJoinLinkUsed) {
if (isUnmounted.current || isJoinLinkUsed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkdengineer Why do you remove this condition !policy ? Should we check isEmptyObject(policy) instead of removing it

Copy link
Contributor Author

@nkdengineer nkdengineer Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DylanDylann In the past we use getPolicy function which returns empty object by default so the check !policy is always false. Now, we're get policy from Onyx so we should remove this check that is preventing join workspace flow.

isEmptyObject(policy) also returns true for undefined or null.

return;
}
if (!isEmptyObject(policy)) {
if (!isEmptyObject(policy) && !policy?.isJoinRequestPending) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkdengineer Why change here?

Copy link
Contributor Author

@nkdengineer nkdengineer Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DylanDylann After we request to join the workspace, policy will not be empty. So if we click the join link again, we will go to initial page. !policy?.isJoinRequestPending is added to prevent it. !isEmptyObject(policy) && !policy?.isJoinRequestPending is the same with isPolicyMember check.

Navigation.isNavigationReady().then(() => {
Navigation.goBack(undefined, false, true);
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? ''));
Expand Down
Loading