From c3355332453e39434d9b6bfad85cb9ef447676dc Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 2 Dec 2022 20:27:25 +0100 Subject: [PATCH] fix tests --- .../shared/lib/dynamic-error-boundary.tsx | 37 ------------------- packages/next/shared/lib/dynamic.tsx | 3 -- packages/next/shared/lib/loadable-context.ts | 2 + 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 packages/next/shared/lib/dynamic-error-boundary.tsx diff --git a/packages/next/shared/lib/dynamic-error-boundary.tsx b/packages/next/shared/lib/dynamic-error-boundary.tsx deleted file mode 100644 index 564205c9e906a3..00000000000000 --- a/packages/next/shared/lib/dynamic-error-boundary.tsx +++ /dev/null @@ -1,37 +0,0 @@ -'use client' - -import React from 'react' -import { NEXT_DYNAMIC_NO_SSR_CODE } from './no-ssr-error' - -class DynamicErrorBoundary extends React.Component< - { children: React.ReactNode }, - { noSSR: boolean } -> { - constructor(props: { children: React.ReactNode }) { - super(props) - this.state = { noSSR: false } - } - - static getDerivedStateFromError(error: any) { - if (error.digest === NEXT_DYNAMIC_NO_SSR_CODE) { - return { noSSR: true } - } - // Re-throw if error is not for dynamic - throw error - } - - render() { - if (this.state.noSSR) { - return null - } - return this.props.children - } -} - -export default function DynamicBoundary({ - children, -}: { - children: React.ReactNode -}) { - return {children} -} diff --git a/packages/next/shared/lib/dynamic.tsx b/packages/next/shared/lib/dynamic.tsx index e70e293eb28530..456b7dc458f014 100644 --- a/packages/next/shared/lib/dynamic.tsx +++ b/packages/next/shared/lib/dynamic.tsx @@ -1,6 +1,5 @@ import React, { Suspense } from 'react' import Loadable from './loadable' -import DynamicBoundary from './dynamic-error-boundary' import { NEXT_DYNAMIC_NO_SSR_CODE } from './no-ssr-error' @@ -75,8 +74,6 @@ export function noSSR

( return () => ( - {/* - */} ) } diff --git a/packages/next/shared/lib/loadable-context.ts b/packages/next/shared/lib/loadable-context.ts index 914b64939d3867..c449b61d3ee962 100644 --- a/packages/next/shared/lib/loadable-context.ts +++ b/packages/next/shared/lib/loadable-context.ts @@ -1,3 +1,5 @@ +'use client' + import React from 'react' type CaptureFn = (moduleName: string) => void