[Bug] Warning: useLayoutEffect does nothing on the server
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- nextjs, react, typescript
Línea de trabajo
Comienza en el punto de entrada Map identificado en el stack trace de SSR en dist/index.modern.mjs:805 y reproduce la advertencia en una aplicación NextJS renderizada en el servidor. Rastrea ese punto de entrada hasta el código fuente del paquete; el trabajo estará terminado cuando el renderizado en el servidor ya no emita la advertencia de useLayoutEffect, mientras el comportamiento en el cliente permanezca intacto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
After installing the react-google-maps package we started getting the following error:
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
2024-05-24T18:49:02.004220106Z at Map (file:///app/node_modules/@vis.gl/react-google-maps/dist/index.modern.mjs:805:5)
In our own project we used something like this to prevent this warning issue.
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect
This means that it will use useLayoutEffect normally, but during Server Side Rendering it will use useEffect
Steps to Reproduce
Use react-google-maps inside of a NextJS project.
Environment
- Library version: 0.11.0
- Google maps version: weekly
- Browser and Version: Chrome
- OS: Alpine Linux
Logs
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
2024-05-24T18:49:02.004220106Z at Map (file:///app/node_modules/@vis.gl/react-google-maps/dist/index.modern.mjs:805:5)
- Lenguaje dominante
- TypeScript
- Estrellas
- 2k
- Forks
- 195
- Merge medio
- 6 h 26 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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 visgl/react-google-maps
-
Polygon / Polyline: edits after a controlled `paths` update never reach `onPathsChanged`Posiblemente ocupada @anubhavlal07 la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
visgl/react-google-maps#1120 ·
Los mantenedores suelen responder en 1 día
-
google maps issue
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
visgl/react-google-maps#1080 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug needs more info
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
visgl/react-google-maps#1039 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
visgl/react-google-maps#918 · 9 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
visgl/react-google-maps#905 ·
Los mantenedores suelen responder en 1 día
Todos los issues de visgl/react-google-maps
Issues similares
-
accessibility area:ci ci-test level:low priority:high type:test
Dificultad 2/5 1-3 horas Aptitud para principiantes 71/100
skytuhua-org/Gen-V1#3132 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
drmrd/vernacular#1238 ·
Los mantenedores suelen responder en 1 día
-
question
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
enhancement migration-prioritized
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Hudson-Pufferfish/local-party-console#136 ·
Los mantenedores suelen responder en 1 día
-
priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día