Skip to content

Commit

Permalink
feat: 修复transition update循环调用 & 新增并发模式的警告
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuan committed Nov 28, 2023
1 parent 9e2a66b commit 38fe544
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Repeater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export const Repeater: FC<IProps> = (props) => {
throw new Promise<void>((resolve) => (resolveRef.current = resolve));
}

// warning
if(mode === 'hidden') {
console.error(
navigator.language === 'zh-CN' ? `
由于react的限制,由startTransition或者useDeferredValue触发的更新引起的组件挂起不会渲染回退,具体可以参考
https://zh-hans.react.dev/reference/react/Suspense#preventing-already-revealed-content-from-hiding
` : `
Due to the limitations of react, component suspension caused by updates triggered by startTransition or useDeferredValue will not render the rollback. For details, please refer to
https://zh-hans.react.dev/reference/react/Suspense#preventing-already-revealed-content-from-hiding
`
)
}

resolvePromise();

return <>{children}</>;
Expand Down

0 comments on commit 38fe544

Please sign in to comment.