github / github/markdown-toolbar-element

Element should not auto-register itself unless a browser context is found

Abierto
#68 8 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
411
Forks
60
Merge medio
2 d 22 h
PR fusionados (30 d)
6

Descripción

Per discussion in https://github.com/primer/react/pull/2339, the fact that this element automatically registers itself at the top level makes it incompatible with server-side rendering, where JavaScript might be run outside of a browser context.

> From an SSR perspective, adding a simple `typeof window !== 'undefined'` guard should be sufficient. However, that won't solve the fact that the markdown-toolbar-element currently executes with side-effects, and thus cannot be tree-shaken. This means bundles in dotcom that do not need toolbar element will carry it as extra weight that is not needed. We would need to add a `register()` function to allow tree shaking, which would be a breaking change on the web component package.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start by reading the discussion in pull request 2339 and the registration behavior described in this issue. Define whether the change should only guard browser access or also introduce an explicit register() API; done should address server-side rendering and avoid unnecessary toolbar-element side effects without leaving the package behavior unresolved.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
frontend, web-dev
Tipo de issue
Refactorización
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
28/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.