react-component / react-component/portal
Uncaught Error: Maximum update depth exceeded.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
react-dom-client.development.js:3860 Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
at getRootForUpdatedFiber (react-dom-client.development.js:3860:1)
at enqueueConcurrentHookUpdate (react-dom-client.development.js:3820:1)
at dispatchSetStateInternal (react-dom-client.development.js:6966:1)
at dispatchSetState (react-dom-client.development.js:6927:1)
at Portal.js:63:1
at Object.react_stack_bottom_frame (react-dom-client.development.js:23953:1)
at runWithFiberInDEV (react-dom-client.development.js:1519:1)
at commitHookEffectListMount (react-dom-client.development.js:11905:1)
at commitHookPassiveMountEffects (react-dom-client.development.js:12026:1)
at commitPassiveMountOnFiber (react-dom-client.development.js:13841:1)
https://github.com/react-component/portal/blob/master/src/Portal.tsx
React.useEffect(() => {
const customizeContainer = getPortalContainer(getContainer);
// Tell component that we check this in effect which is safe to be `null`
setInnerContainer(customizeContainer ?? null);
});
是不是此处导致的,还是我外部使用不对导致的?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Portal.tsx and the useEffect shown in the report; inspect how getContainer and setInnerContainer interact during passive effects. Reproduce the maximum-depth error with the reported usage, then verify the failing case no longer loops and document the relevant test or reproduction result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100