Skip to content

Commit 7089a8f

Browse files
committed
fix(submit-onboarding): open side panel on every desktop width
Mirror the SidePanelContextProvider convention by passing `!isSmallScreenWidth` to `SidePanelActions.openSidePanel` from `navigateToSubmitWorkspaceAfterOnboarding`. The previous hard-coded `false` only set the wide-screen NVP key, so the panel stayed hidden in the 800-1300 px desktop range. mWeb still gets `false`, preserving the earlier fix that prevented the auto-bounce to Concierge.
1 parent 8d3c4ad commit 7089a8f

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/hooks/useAutoCreateSubmitWorkspace.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import useLocalize from './useLocalize';
1717
import useOnboardingMessages from './useOnboardingMessages';
1818
import useOnyx from './useOnyx';
1919
import usePreferredPolicy from './usePreferredPolicy';
20+
import useResponsiveLayout from './useResponsiveLayout';
2021

2122
/**
2223
* Hook that provides a function to auto-create a Submit workspace for EMPLOYER
@@ -50,6 +51,8 @@ function useAutoCreateSubmitWorkspace() {
5051
const {isRestrictedPolicyCreation} = usePreferredPolicy();
5152
const hasActiveAdminPolicies = useHasActiveAdminPolicies();
5253
const {onboardingMessages} = useOnboardingMessages();
54+
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
55+
const {isSmallScreenWidth} = useResponsiveLayout();
5356

5457
const autoCreateSubmitWorkspace = useCallback(
5558
(firstName: string, lastName: string) => {
@@ -93,7 +96,7 @@ function useAutoCreateSubmitWorkspace() {
9396
setOnboardingAdminsChatReportID();
9497
setOnboardingPolicyID();
9598

96-
navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(newPolicyID);
99+
navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(newPolicyID, isSmallScreenWidth);
97100
},
98101
[
99102
currentUserEmail,
@@ -112,6 +115,7 @@ function useAutoCreateSubmitWorkspace() {
112115
onboardingMessages,
113116
betas,
114117
hasActiveAdminPolicies,
118+
isSmallScreenWidth,
115119
],
116120
);
117121

src/libs/navigateAfterOnboarding.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function navigateAfterOnboardingWithMicrotaskQueue(
131131
* navigate to Workspace > Categories with the side panel open so
132132
* the #admins room is visible in Concierge Anywhere.
133133
*/
134-
function navigateToSubmitWorkspaceAfterOnboarding(policyID?: string) {
134+
function navigateToSubmitWorkspaceAfterOnboarding(policyID?: string, isSmallScreenWidth = false) {
135135
setDisableDismissOnEscape(false);
136136

137137
if (!policyID) {
@@ -140,21 +140,17 @@ function navigateToSubmitWorkspaceAfterOnboarding(policyID?: string) {
140140
}
141141

142142
setOnboardingRHPVariant(CONST.ONBOARDING_RHP_VARIANT.RHP_ADMINS_ROOM);
143-
// Push the Workspaces list first so the native back stack lands there
144-
// after the user finishes exploring their newly created/joined Submit
145-
// workspace. The second navigate is queued on the microtask queue so
146-
// both calls are processed sequentially rather than batched.
147143
Navigation.navigate(ROUTES.WORKSPACES_LIST.route);
148144
Navigation.setNavigationActionToMicrotaskQueue(() => {
149145
Navigation.navigate(ROUTES.WORKSPACE_CATEGORIES.getRoute(policyID));
150-
SidePanelActions.openSidePanel(false);
146+
SidePanelActions.openSidePanel(!isSmallScreenWidth);
151147
});
152148
}
153149

154-
function navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(policyID?: string) {
150+
function navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(policyID?: string, isSmallScreenWidth = false) {
155151
Navigation.dismissModal();
156152
Navigation.setNavigationActionToMicrotaskQueue(() => {
157-
navigateToSubmitWorkspaceAfterOnboarding(policyID);
153+
navigateToSubmitWorkspaceAfterOnboarding(policyID, isSmallScreenWidth);
158154
});
159155
}
160156

src/pages/OnboardingWorkspaces/BaseOnboardingWorkspaces.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding
107107
setOnboardingPolicyID(policy.policyID);
108108

109109
if (shouldUseSubmitFlow && policy.automaticJoiningEnabled) {
110-
navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(policy.policyID);
110+
navigateToSubmitWorkspaceAfterOnboardingWithMicrotaskQueue(policy.policyID, isSmallScreenWidth);
111111
return;
112112
}
113113

tests/unit/hooks/useAutoCreateSubmitWorkspace.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('useAutoCreateSubmitWorkspace', () => {
161161
// Then the user should be navigated to the newly created Submit workspace
162162
// so they land on their workspace immediately after onboarding
163163
expect(navigateSpy).toHaveBeenCalledTimes(1);
164-
expect(navigateSpy).toHaveBeenCalledWith(MOCK_POLICY_ID);
164+
expect(navigateSpy).toHaveBeenCalledWith(MOCK_POLICY_ID, expect.any(Boolean));
165165
});
166166

167167
it('reuses the existing onboarding workspace instead of creating a new one', () => {

0 commit comments

Comments
 (0)