Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemixErrorBoundary caught in infinite crash loop when exception thrown in root handler in browser #2118

Closed
ngbrown opened this issue Feb 24, 2022 · 1 comment
Labels
bug:unverified duplicate This issue or pull request already exists

Comments

@ngbrown
Copy link
Contributor

ngbrown commented Feb 24, 2022

What version of Remix are you using?

1.2.1

Steps to Reproduce

Add default error handler in root.tsx https://remix.run/docs/en/v1/guides/errors#root-error-boundary

Add code that will throw in the browser in the root index.tsx:

export default function Index() {
  if (typeof window !== "undefined") {
    (0 as any).missingFunction();
  }

  return (
    <div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
      <h1>Hi</h1>
    </div>
  );
}

Expected Behavior

Display a blank page and "Oh No" in the title without freezing up the browser tab with endless console errors.

Actual Behavior

entry.client-KIPMOS4E.js:7764 Uncaught DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed.
    at appendChildToContainer (http://localhost:3000/build/entry.client-KIPMOS4E.js:7764:24)
    at insertOrAppendPlacementNodeIntoContainer (http://localhost:3000/build/entry.client-KIPMOS4E.js:15326:15)
    at insertOrAppendPlacementNodeIntoContainer (http://localhost:3000/build/entry.client-KIPMOS4E.js:15333:15)
    at commitPlacement (http://localhost:3000/build/entry.client-KIPMOS4E.js:15313:13)
    at commitMutationEffects (http://localhost:3000/build/entry.client-KIPMOS4E.js:16675:17)
    at HTMLUnknownElement.callCallback2 (http://localhost:3000/build/entry.client-KIPMOS4E.js:3680:22)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/build/entry.client-KIPMOS4E.js:3705:24)
    at invokeGuardedCallback (http://localhost:3000/build/entry.client-KIPMOS4E.js:3739:39)
    at commitRootImpl (http://localhost:3000/build/entry.client-KIPMOS4E.js:16520:17)
    at unstable_runWithPriority (http://localhost:3000/build/entry.client-KIPMOS4E.js:351:20)
appendChildToContainer @ entry.client-KIPMOS4E.js:7764
insertOrAppendPlacementNodeIntoContainer @ entry.client-KIPMOS4E.js:15326
insertOrAppendPlacementNodeIntoContainer @ entry.client-KIPMOS4E.js:15333
commitPlacement @ entry.client-KIPMOS4E.js:15313
commitMutationEffects @ entry.client-KIPMOS4E.js:16675
callCallback2 @ entry.client-KIPMOS4E.js:3680
invokeGuardedCallbackDev @ entry.client-KIPMOS4E.js:3705
invokeGuardedCallback @ entry.client-KIPMOS4E.js:3739
commitRootImpl @ entry.client-KIPMOS4E.js:16520
unstable_runWithPriority @ entry.client-KIPMOS4E.js:351
runWithPriority$1 @ entry.client-KIPMOS4E.js:8477
commitRoot @ entry.client-KIPMOS4E.js:16441
performSyncWorkOnRoot @ entry.client-KIPMOS4E.js:16006
(anonymous) @ entry.client-KIPMOS4E.js:8517
unstable_runWithPriority @ entry.client-KIPMOS4E.js:351
runWithPriority$1 @ entry.client-KIPMOS4E.js:8477
flushSyncCallbackQueueImpl @ entry.client-KIPMOS4E.js:8513
flushSyncCallbackQueue @ entry.client-KIPMOS4E.js:8503
unbatchedUpdates @ entry.client-KIPMOS4E.js:16084
legacyRenderSubtreeIntoContainer @ entry.client-KIPMOS4E.js:18579
hydrate2 @ entry.client-KIPMOS4E.js:18628
(anonymous) @ entry.client-KIPMOS4E.js:18790
2entry.client-KIPMOS4E.js:14603 The above error occurred in the <ErrorBoundary> component:

    at ErrorBoundary (http://localhost:3000/build/root-ME527SWU.js:23:26)
    at RemixErrorBoundary (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:878:5)
    at RemixRoute (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:2423:3)
    at Routes2 (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:2406:7)
    at Router (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:218:15)
    at RemixCatchBoundary (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:953:10)
    at RemixErrorBoundary (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:878:5)
    at RemixEntry (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:2303:12)
    at RemixBrowser (http://localhost:3000/build/_shared/chunk-WBC6FA6Y.js:2720:27)

React will try to recreate this component tree from scratch using the error boundary you provided, RemixErrorBoundary.
logCapturedError @ entry.client-KIPMOS4E.js:14603
update.payload @ entry.client-KIPMOS4E.js:14634
getStateFromUpdate @ entry.client-KIPMOS4E.js:9093
processUpdateQueue @ entry.client-KIPMOS4E.js:9192
updateClassInstance @ entry.client-KIPMOS4E.js:9757
updateClassComponent @ entry.client-KIPMOS4E.js:12945
beginWork @ entry.client-KIPMOS4E.js:13993
beginWork$1 @ entry.client-KIPMOS4E.js:17074
performUnitOfWork @ entry.client-KIPMOS4E.js:16317
workLoopSync @ entry.client-KIPMOS4E.js:16268
renderRootSync @ entry.client-KIPMOS4E.js:16243
performSyncWorkOnRoot @ entry.client-KIPMOS4E.js:15983
(anonymous) @ entry.client-KIPMOS4E.js:8517
unstable_runWithPriority @ entry.client-KIPMOS4E.js:351
runWithPriority$1 @ entry.client-KIPMOS4E.js:8477
flushSyncCallbackQueueImpl @ entry.client-KIPMOS4E.js:8513
flushSyncCallbackQueue @ entry.client-KIPMOS4E.js:8503
unbatchedUpdates @ entry.client-KIPMOS4E.js:16084
legacyRenderSubtreeIntoContainer @ entry.client-KIPMOS4E.js:18579
hydrate2 @ entry.client-KIPMOS4E.js:18628
(anonymous) @ entry.client-KIPMOS4E.js:18790

Screenshot - 2022-02-24_15-11-15

Screenshot - 2022-02-24_15-11-58

@ngbrown ngbrown added the bug Something isn't working label Feb 24, 2022
@machour machour added bug:unverified duplicate This issue or pull request already exists and removed bug Something isn't working labels Mar 20, 2022
@machour
Copy link
Collaborator

machour commented Mar 23, 2022

Duplicate of #1678

@machour machour marked this as a duplicate of #1678 Mar 23, 2022
@machour machour closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unverified duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants