Skip to content

Commit 155ce98

Browse files
committed
fix(split-layout): Pass setCurrentSplitLayout to ResetPassword to prevent navigation split layout blips
Because: * Navigating from a page with split layout to a page without, like from signin to reset password, keeps the transition screens with loading spinner set to 'split layout', causing visual blips of split layout while going through the reset PW flow This commit: * Passes setCurrentSplitLayout on the reset PW page to reset split layout back to a non-split layout closes FXA-13245
1 parent 7406c2e commit 155ce98

5 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/fxa-settings/src/components/App/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ const AuthAndAccountSetupRoutes = ({
568568
{/* Reset password */}
569569
<ResetPasswordContainer
570570
path="/reset_password/*"
571-
{...{ flowQueryParams, serviceName }}
571+
{...{ flowQueryParams, serviceName, setCurrentSplitLayout }}
572572
/>
573573
<ConfirmResetPasswordContainer
574574
path="/confirm_reset_password/*"

packages/fxa-settings/src/pages/ResetPassword/ResetPassword/container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getLocalizedErrorMessage } from '../../../lib/error-utils';
1515
const ResetPasswordContainer = ({
1616
flowQueryParams = {},
1717
serviceName,
18+
setCurrentSplitLayout,
1819
}: ResetPasswordContainerProps & RouteComponentProps) => {
1920
const authClient = useAuthClient();
2021
const ftlMsgResolver = useFtlMsgResolver();
@@ -49,6 +50,7 @@ const ResetPasswordContainer = ({
4950
requestResetPasswordCode,
5051
serviceName,
5152
setErrorMessage,
53+
setCurrentSplitLayout,
5254
}}
5355
/>
5456
);

packages/fxa-settings/src/pages/ResetPassword/ResetPassword/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const ResetPassword = ({
2525
requestResetPasswordCode,
2626
serviceName,
2727
setErrorMessage,
28+
setCurrentSplitLayout,
2829
}: ResetPasswordProps & RouteComponentProps) => {
2930
const [isSubmitting, setIsSubmitting] = useState(false);
3031

@@ -81,7 +82,7 @@ const ResetPassword = ({
8182
};
8283

8384
return (
84-
<AppLayout>
85+
<AppLayout {...{ setCurrentSplitLayout }}>
8586
<FtlMsg id="password-reset-flow-heading">
8687
<h1 className="card-header">Reset your password</h1>
8788
</FtlMsg>

packages/fxa-settings/src/pages/ResetPassword/ResetPassword/interfaces.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ import { MozServices } from '../../../lib/types';
88
export interface ResetPasswordContainerProps {
99
flowQueryParams?: QueryParams;
1010
serviceName: MozServices;
11+
setCurrentSplitLayout: (value: boolean) => void;
1112
}
1213

1314
export interface ResetPasswordProps {
1415
errorMessage?: string;
1516
requestResetPasswordCode: (email: string) => Promise<void>;
1617
serviceName: MozServices;
1718
setErrorMessage: React.Dispatch<React.SetStateAction<string>>;
19+
/**
20+
* Although Reset Password does not use the split layout, navigating from
21+
* a page that does (like signin) causes split layout to be shown during
22+
* page transitions. We "reset" the layout by passing this value in on
23+
* the first reset PW screen (/reset_password).
24+
*/
25+
setCurrentSplitLayout: (value: boolean) => void;
1826
}
1927

2028
export interface ResetPasswordFormData {

packages/fxa-settings/src/pages/ResetPassword/ResetPassword/mocks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const Subject = ({
2424
serviceName,
2525
requestResetPasswordCode,
2626
setErrorMessage,
27+
setCurrentSplitLayout: () => {},
2728
}}
2829
/>
2930
</LocationProvider>

0 commit comments

Comments
 (0)