From 5a855b70bca8ece4a2f64ca24776020b6abe0720 Mon Sep 17 00:00:00 2001 From: Vaggelis Yfantis Date: Fri, 8 Dec 2023 13:46:15 +0200 Subject: [PATCH] chore(clerk-react): Use errorThrower utility to throw error in withPathDefaultRouting --- packages/react/src/components/withPathBasedRouting.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/react/src/components/withPathBasedRouting.tsx b/packages/react/src/components/withPathBasedRouting.tsx index 1eaede62048..d3aae4f4550 100644 --- a/packages/react/src/components/withPathBasedRouting.tsx +++ b/packages/react/src/components/withPathBasedRouting.tsx @@ -2,11 +2,13 @@ import type { RoutingOptions } from '@clerk/types'; import type { ComponentProps, ComponentType } from 'react'; import React from 'react'; +import { errorThrower } from '../utils/errorThrower'; + export function withPathDefaultRouting(Component: T): T { const BaseComponent = Component as ComponentType; const HOC = (props: ComponentProps>) => { if (!props.path && !props.routing) { - throw new Error('Clerk: You must specify path and routing props'); + errorThrower.throw('You must specify path and routing props'); } if (props.path) { @@ -24,7 +26,6 @@ export function withPathDefaultRouting(Component: T HOC.displayName = BaseComponent.displayName; return Object.assign(HOC, { - displayName: BaseComponent.displayName, ...BaseComponent, - }) as unknown as T; + }) as T; }