Skip to content

Commit 80f64ba

Browse files
committed
Fix display name of redirect guards
1 parent c6c3b72 commit 80f64ba

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

packages/clerk-js/src/ui/common/withRedirect.tsx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,14 @@ export const withRedirectToSignInTask = <P extends AvailableComponentProps>(Comp
9999

100100
return withRedirect(
101101
Component,
102-
clerk => !!clerk.session?.currentTask,
103-
({ clerk }) => {
104-
const currentTask = clerk.session?.currentTask;
105-
if (!currentTask || !signInCtx?.taskUrl) {
106-
return '';
107-
}
108-
109-
return signInCtx?.taskUrl;
110-
},
102+
clerk => Boolean(clerk.session?.currentTask && signInCtx?.taskUrl),
103+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
104+
() => signInCtx.taskUrl!,
111105
undefined,
112106
)(props);
113107
};
114108

115-
HOC.displayName = `withRedirectToAfterSignIn(${displayName})`;
109+
HOC.displayName = `withRedirectToSignInTask(${displayName})`;
116110

117111
return HOC;
118112
};
@@ -126,20 +120,14 @@ export const withRedirectToSignUpTask = <P extends AvailableComponentProps>(Comp
126120

127121
return withRedirect(
128122
Component,
129-
clerk => !!clerk.session?.currentTask,
130-
({ clerk }) => {
131-
const currentTask = clerk.session?.currentTask;
132-
if (!currentTask || !signUpCtx?.taskUrl) {
133-
return '';
134-
}
135-
136-
return signUpCtx?.taskUrl;
137-
},
123+
clerk => Boolean(clerk.session?.currentTask && signUpCtx?.taskUrl),
124+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
125+
() => signUpCtx.taskUrl!,
138126
undefined,
139127
)(props);
140128
};
141129

142-
HOC.displayName = `withRedirectToAfterSignIn(${displayName})`;
130+
HOC.displayName = `withRedirectToSignUpTask(${displayName})`;
143131

144132
return HOC;
145133
};

0 commit comments

Comments
 (0)