React version fragmentation - Mixed React 17 and 18 causing bundle bloat and runtime issues
Los mantenedores suelen responder en 1 día
@AbhishekBRajpurohit ya está trabajando en esto.
Desde el 20/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- javascript, react
- Área
- build-system, frontend
Línea de trabajo
Inspecciona los archivos package.json del repositorio y empieza con yarn why react para inventariar las versiones en conflicto y los roles de las dependencias. Revisa los puntos de entrada de renderizado indicados, si existen, y después ejecuta yarn install, las pruebas unitarias y E2E, y yarn build. Se considera terminado cuando todos los paquetes usan React 18.x de forma coherente, la instalación no muestra advertencias de peer, las pruebas pasan y el bundle contiene una única instancia de React.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
The EmbeddedChat monorepo has inconsistent React versions across packages, causing peer dependency conflicts, potential runtime errors, and significant bundle size increase.
Current State
Packages using React 17.0.2 (as peerDependencies)
@embeddedchat/react@embeddedchat/ui-kit@embeddedchat/ui-elements@embeddedchat/markups
Packages using React 18.2.0 (as dependencies or peerDependencies)
@embeddedchat/htmlembed@embeddedchat/layout_editor@embeddedchat/e2e-react@embeddedchat/react-native
Impact
Build & Runtime Issues
- ⚠️ Peer dependency warnings during installation
- ⚠️ Multiple React instances bundled together
- ⚠️ Duplicate React in bundle (~200KB overhead, 97% increase)
- ⚠️ React Context doesn't work across package boundaries
- ⚠️ React Hooks behave unexpectedly with multiple instances
- ⚠️ Different feature sets (React 18 has Suspense, Concurrent Mode, etc.)
Example Error Scenarios
Warning: Invalid hook call. Hooks can only be called inside the body of a function component.
This could happen for one of the following reasons:
1. You might have mismatching versions of React and React DOM
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
Evidence
Run this in the monorepo root:
# Check all React versions
yarn why react
# Example output shows multiple versions:
# [email protected] - ui-kit, react, ui-elements, markups
# [email protected] - htmlembed, layout_editor, react-native
Proposed Solution
Option 1: Migrate All to React 18 (Recommended)
React 18 is backward compatible with React 17 code. Migrate all packages to use React 18 with broad peer dependencies.
Benefits:
- ✅ Access to React 18 features (Suspense, Concurrent Mode, Automatic Batching)
- ✅ Single React instance
- ✅ Future-proof (React 19 compatibility path)
- ✅ Smaller bundle size
Changes needed:
// For library packages (@embeddedchat/react, ui-kit, ui-elements, markups)
{
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
// For application packages (htmlembed, layout_editor, e2e-react)
{
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
Migration steps:
-
Update all package.json files
- Libraries: Use
"react": "^18.0.0"in peerDependencies - Apps: Use
"react": "^18.2.0"in dependencies
- Libraries: Use
-
Update React imports if needed
// If using React 17 style - import React from 'react'; - import ReactDOM from 'react-dom'; + import { createRoot } from 'react-dom/client'; -
Test for breaking changes
- Most React 17 code works in React 18
- Main change:
ReactDOM.render→createRoot - Check for
UNSAFE_*lifecycle methods
-
Update root rendering (if applicable)
// React 17 ReactDOM.render(<App />, document.getElementById('root')); // React 18 const root = createRoot(document.getElementById('root')); root.render(<App />);
Option 2: Keep React 17, Align All Packages
If React 18 migration is not desired:
{
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}
Downside: Miss out on React 18 features and future compatibility.
Implementation Plan
Phase 1: Audit & Plan
- List all packages with React dependencies
- Identify React 18-specific code (if any)
- Check for
UNSAFE_*lifecycle methods - Review third-party dependencies' React requirements
Phase 2: Update Dependencies
- Update all
package.jsonfiles to React 18 - Update
peerDependenciesto use^18.0.0 - Remove
reactfromdependenciesin library packages (keep as peer only) - Run
yarn installto resolve dependencies
Phase 3: Update Code
- Update root rendering to use
createRoot(if applicable) - Replace any React 17-specific patterns
- Update tests to use React 18 testing library
Phase 4: Test
- Run all unit tests
- Run E2E tests
- Test bundle size (should decrease)
- Manual testing of all features
- Check for console warnings about multiple React instances
Verification
After fix, verify single React instance:
# Should show only React 18.x
yarn why react
# Check bundle size (should be smaller)
yarn build
ls -lh dist/ # Compare before/after
Benefits
✅ Single React instance - No duplicate React in bundle
✅ Smaller bundle size - ~200KB reduction
✅ No peer dependency warnings
✅ Consistent behavior - Same React version everywhere
✅ React 18 features - Suspense, Concurrent Mode, etc.
✅ Better DX - No version-related debugging
✅ Future-proof - Easier to upgrade to React 19
Estimated Effort
Time: 1-2 days
Complexity: Medium
Risk: Low (React 18 is backward compatible)
Files affected: 8-12 package.json files, possibly 1-2 rendering files
References
Acceptance Criteria
- All packages use same React version (18.x)
- No peer dependency warnings during install
- Single React instance in bundle (verify with
yarn why react) - All tests passing
- Bundle size reduced
- No console warnings about multiple React instances
- Documentation updated with React 18 requirement
Discovered during: Comprehensive codebase analysis
Priority: HIGH - Causes build warnings and bundle bloat
Category: Dependencies / Build Configuration
- Lenguaje dominante
- JavaScript
- Estrellas
- 171
- Forks
- 421
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RocketChat/EmbeddedChat
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migrationPosiblemente ocupada @MuhammadFaizan-prog la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
RocketChat/EmbeddedChat#1489 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)Posiblemente ocupada @yashsarvaiya45 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
RocketChat/EmbeddedChat#1486 ·
Los mantenedores suelen responder en 1 día
-
bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticatedPosiblemente ocupada @ashwanisingh011 la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
RocketChat/EmbeddedChat#1484 ·
Los mantenedores suelen responder en 1 día
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContextPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RocketChat/EmbeddedChat#1482 ·
Los mantenedores suelen responder en 1 día
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed outPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RocketChat/EmbeddedChat#1480 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de RocketChat/EmbeddedChat
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Life-Framework/Life-Framework#7017 ·
Los mantenedores suelen responder en 1 día
-
e/DevOps enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Accenture/sfmc-devtools#2795 ·
Los mantenedores suelen responder en 1 día
-
agent/guide documentation help wanted stage/010-actionable
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kubestellar/console-kb#4003 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FilOzone/synapse-sdk#1201 · 1 comentario ·
Los mantenedores suelen responder en 1 día