NaokiHigashi28 1 год назад
Родитель
Сommit
365e60428e

+ 6 - 5
packages/pluginkit/src/v4/client/utils/growi-facade/growi-react.ts

@@ -13,17 +13,18 @@ declare global {
  * Retrieves the React instance that this package should use.
  *
  * - **Production Mode**: Returns the React instance from `window.GrowiFacade.react`
- *   to ensure consistency with GROWI's main React version.
+ *   to ensure a single shared React instance across the app.
  * - **Development Mode**: Returns the React instance passed as an argument,
- *   which typically allows local/hot reload development without conflicts.
+ *   which allows local development and hot reload without issues.
  *
  * @param react - The React instance to use during development
  * @returns A React instance to be used in the current environment
  *
  * @remarks
- * This approach prevents bundling multiple React versions and avoids Hook conflicts.
- * Make sure the `window.GrowiFacade.react` object is set before calling this function
- * in a production environment.
+ * Using multiple React instances in a single app can cause serious issues,
+ * especially with features like Hooks, which rely on a consistent internal state.
+ * This function ensures that only one React instance is used in production
+ * to avoid such problems.
  */
 export const growiReact = (react: typeof React): typeof React => {
   if (process.env.NODE_ENV === 'production') {