github / github/markdown-toolbar-element

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

オープン
#68 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
411
フォーク
60
平均マージ
2日 22時間
マージ済み PR(30日)
6

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend, web-dev
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。