Skip to content

Commit 6c7429b

Browse files
committed
use isThenable
1 parent c54e779 commit 6c7429b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/react/src/reactrouter-compat-utils/lazy-routes.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addNonEnumerableProperty, debug } from '@sentry/core';
1+
import { addNonEnumerableProperty, debug, isThenable } from '@sentry/core';
22
import { DEBUG_BUILD } from '../debug-build';
33
import type { Location, RouteObject } from '../types';
44

@@ -33,12 +33,7 @@ export function handleAsyncHandlerResult(
3333
handlerKey: string,
3434
processResolvedRoutes: (resolvedRoutes: RouteObject[], parentRoute?: RouteObject, currentLocation?: Location) => void,
3535
): void {
36-
if (
37-
result &&
38-
typeof result === 'object' &&
39-
'then' in result &&
40-
typeof (result as Promise<unknown>).then === 'function'
41-
) {
36+
if (isThenable(result)) {
4237
(result as Promise<unknown>)
4338
.then((resolvedRoutes: unknown) => {
4439
if (Array.isArray(resolvedRoutes)) {

0 commit comments

Comments
 (0)