From 2ee657bc1e0cce0dba157c8e5f6717a71381e636 Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan Date: Mon, 19 Sep 2022 01:40:27 +0530 Subject: [PATCH] revert react 18 --- .../docusaurus/src/client/clientEntry.tsx | 89 +++++++++---------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/packages/docusaurus/src/client/clientEntry.tsx b/packages/docusaurus/src/client/clientEntry.tsx index d21e15df1d..8e53d92e10 100644 --- a/packages/docusaurus/src/client/clientEntry.tsx +++ b/packages/docusaurus/src/client/clientEntry.tsx @@ -5,48 +5,47 @@ * LICENSE file in the root directory of this source tree. */ - import React from 'react'; - import ReactDOM from 'react-dom'; - import {BrowserRouter} from 'react-router-dom'; - import {HelmetProvider} from 'react-helmet-async'; - - import ExecutionEnvironment from './exports/ExecutionEnvironment'; - import App from './App'; - import preload from './preload'; - import docusaurus from './docusaurus'; - - declare global { - interface NodeModule { - hot?: {accept: () => void}; - } - } - - // Client-side render (e.g: running in browser) to become single-page - // application (SPA). - if (ExecutionEnvironment.canUseDOM) { - window.docusaurus = docusaurus; - // For production, attempt to hydrate existing markup for performant - // first-load experience. - // For development, there is no existing markup so we had to render it. - // We also preload async component to avoid first-load loading screen. - const renderMethod = - process.env.NODE_ENV === 'production' ? ReactDOM.hydrate : ReactDOM.render; - preload(window.location.pathname).then(() => { - renderMethod( - - - - - , - document.getElementById('__docusaurus'), - ); - }); - - // Webpack Hot Module Replacement API - if (module.hot) { - // Self-accepting method/ trick - // (https://github.com/webpack/webpack-dev-server/issues/100#issuecomment-290911036) - module.hot.accept(); - } - } - \ No newline at end of file +import React from 'react'; +import ReactDOM from 'react-dom'; +import {BrowserRouter} from 'react-router-dom'; +import {HelmetProvider} from 'react-helmet-async'; + +import ExecutionEnvironment from './exports/ExecutionEnvironment'; +import App from './App'; +import preload from './preload'; +import docusaurus from './docusaurus'; + +declare global { + interface NodeModule { + hot?: {accept: () => void}; + } +} + +// Client-side render (e.g: running in browser) to become single-page +// application (SPA). +if (ExecutionEnvironment.canUseDOM) { + window.docusaurus = docusaurus; + // For production, attempt to hydrate existing markup for performant + // first-load experience. + // For development, there is no existing markup so we had to render it. + // We also preload async component to avoid first-load loading screen. + const renderMethod = + process.env.NODE_ENV === 'production' ? ReactDOM.hydrate : ReactDOM.render; + preload(window.location.pathname).then(() => { + renderMethod( + + + + + , + document.getElementById('__docusaurus'), + ); + }); + + // Webpack Hot Module Replacement API + if (module.hot) { + // Self-accepting method/ trick + // (https://github.com/webpack/webpack-dev-server/issues/100#issuecomment-290911036) + module.hot.accept(); + } +}