Skip to content

Commit

Permalink
fix(core): log missing errorInfo in React 18 onRecoverableError callb…
Browse files Browse the repository at this point in the history
…ack (#9387)

Co-authored-by: sebastienlorber <[email protected]>
  • Loading branch information
johnnyreilly and slorber authored Oct 9, 2023
1 parent d86aa0d commit 643a7fe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/docusaurus/src/client/clientEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React from 'react';
import ReactDOM from 'react-dom/client';
import ReactDOM, {type ErrorInfo} from 'react-dom/client';
import {BrowserRouter} from 'react-router-dom';
import {HelmetProvider} from 'react-helmet-async';

Expand Down Expand Up @@ -37,8 +37,12 @@ if (ExecutionEnvironment.canUseDOM) {
</HelmetProvider>
);

const onRecoverableError = (error: unknown): void => {
console.error('Docusaurus React Root onRecoverableError:', error);
const onRecoverableError = (error: unknown, errorInfo: ErrorInfo): void => {
console.error(
'Docusaurus React Root onRecoverableError:',
error,
errorInfo,
);
};

const renderApp = () => {
Expand Down

0 comments on commit 643a7fe

Please sign in to comment.