Skip to content

Commit

Permalink
docs(react): remove CSROnly section in AsyncBoundary
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Dec 27, 2023
1 parent 6ff50d4 commit 69df118
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 63 deletions.
30 changes: 0 additions & 30 deletions docs/v1/src/pages/docs/react/AsyncBoundary.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,6 @@ type AsyncBoundaryProps = Omit<SuspenseProps, 'fallback'> &
}
```
### Avoid Server side rendering (CSROnly)
<Callout type='warning'>
deprecated: Use `<Suspense.CSROnly/>` and `<ErrorBoundary/>` directly
</Callout>
Since it wraps `<Suspense.CSROnly/>`, it provides the same CSROnly.
```tsx /AsyncBoundary.CSROnly/
import { AsyncBoundary } from '@suspensive/react'

const Example = () => (
<AsyncBoundary.CSROnly
pendingFallback={<Loading />}
rejectedFallback={(props) => (
<>
<button onClick={props.reset}>Try again</button>
{props.error.message}
</>
)}
onReset={() => console.log('reset')}
onError={(error) => console.log(error)}
>
<Children />
</AsyncBoundary.CSROnly>
)
```

## withAsyncBoundary
<Callout type='warning'>
Expand Down
30 changes: 0 additions & 30 deletions docs/v1/src/pages/docs/react/AsyncBoundary.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,6 @@ type AsyncBoundaryProps = Omit<SuspenseProps, 'fallback'> &
}
```
### 서버사이드 렌더링을 피하기 (CSROnly)
<Callout type='warning'>
deprecated: `<Suspense.CSROnly/>``<ErrorBoundary/>`를 직접 사용하세요
</Callout>
`<Suspense.CSROnly/>`를 래핑하기 때문에 동일하게 CSROnly를 제공합니다.
```tsx /AsyncBoundary.CSROnly/
import { AsyncBoundary } from '@suspensive/react'

const Example = () => (
<AsyncBoundary.CSROnly
pendingFallback={<Loading />}
rejectedFallback={(props) => (
<>
<button onClick={props.reset}>Try again</button>
{props.error.message}
</>
)}
onReset={() => console.log('reset')}
onError={(error) => console.log(error)}
>
<Children />
</AsyncBoundary.CSROnly>
)
```

## withAsyncBoundary
<Callout type='warning'>
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/AsyncBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type ComponentRef, type SuspenseProps, forwardRef } from 'react'
import { type ComponentRef, forwardRef } from 'react'
import { ErrorBoundary, type ErrorBoundaryProps } from './ErrorBoundary'
import { Suspense } from './Suspense'
import { Suspense, type SuspenseProps } from './Suspense'
import type { PropsWithoutDevMode } from './utility-types'

/**
Expand All @@ -23,7 +23,7 @@ const BaseAsyncBoundary = forwardRef<ComponentRef<typeof ErrorBoundary>, AsyncBo
if (process.env.NODE_ENV !== 'production') {
BaseAsyncBoundary.displayName = 'AsyncBoundary'
}
const CSROnly = forwardRef<ComponentRef<typeof ErrorBoundary>, AsyncBoundaryProps>(
const CSROnly = forwardRef<ComponentRef<typeof ErrorBoundary>, Omit<AsyncBoundaryProps, 'csrOnly'>>(
({ pendingFallback, rejectedFallback, children, ...errorBoundaryProps }, resetRef) => (
<ErrorBoundary {...errorBoundaryProps} ref={resetRef} fallback={rejectedFallback}>
<Suspense.CSROnly fallback={pendingFallback}>{children}</Suspense.CSROnly>
Expand Down

0 comments on commit 69df118

Please sign in to comment.