diff --git a/samples/routing/react-router-dom-v6-data/src/components/Nav.tsx b/samples/routing/react-router-dom-v6-data/src/components/Nav.tsx index e26ad7ae..fa2b9bb4 100644 --- a/samples/routing/react-router-dom-v6-data/src/components/Nav.tsx +++ b/samples/routing/react-router-dom-v6-data/src/components/Nav.tsx @@ -23,7 +23,7 @@ const Nav = () => { Protected {isAuthenticated && <> - Profile + Profile } diff --git a/src/containers/LoginCallback.tsx b/src/containers/LoginCallback.tsx index 0337da10..0dd55346 100644 --- a/src/containers/LoginCallback.tsx +++ b/src/containers/LoginCallback.tsx @@ -11,7 +11,6 @@ */ import * as React from 'react'; -import { AuthSdkError } from '@okta/okta-auth-js'; import useLoginCallback, { LoginCallbackOptions } from '../hooks/useLoginCallback'; import useComponents, { ComponentsOptions } from '../hooks/useComponents'; import useOktaAuth from '../context/useOktaAuth'; @@ -27,13 +26,12 @@ const LoginCallback: React.FC = ({ const { ErrorReporter, Loading } = useComponents(oktaContext, options); if (!isLoginRedirect) { + // This can happen if is mounted to a wrong route + // or there are no requried query/hash parameters in the URL if (children) { return (<>{children}); } else { - // This can happen if is mounted to a wrong route - // or there are no requried query/hash parameters in the URL - const error = new AuthSdkError('Can\'t handle login redirect'); - return ; + return null; } } else if (callbackError) { return ; diff --git a/test/jest/specs/loginCallback.test.tsx b/test/jest/specs/loginCallback.test.tsx index 63a3185e..4bcdb637 100644 --- a/test/jest/specs/loginCallback.test.tsx +++ b/test/jest/specs/loginCallback.test.tsx @@ -172,14 +172,14 @@ describe('', () => { isLoginRedirect = false; }); - it('if there are no children, renders error', async () => { + it('if there are no children, renders null', async () => { const wrapper = mount( ); expect(wrapper.find(LoginCallback).length).toBe(1); - expect(wrapper.text()).toBe('AuthSdkError: Can\'t handle login redirect'); + expect(wrapper.text()).toBe(''); }); it('renders children as a fallback', async () => {