UiKit modal and contextual bar remount on every re-render, typed input is lost
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, react
- 領域
- frontend
調査の方向性
問題のキーは packages/react/src/views/ChatBody/ChatBody.js の UiKitModal(440行目付近)と、packages/react/src/views/ChatLayout/ChatLayout.js の UiKitContextualBar(173行目付近)にあります。ビューのデータオブジェクトが安定した id を持っていることを確認し、Math.random() をその id に置き換えてください。モーダルまたはコンテキストバーに入力したテキストが、新しいメッセージによってルームが再レンダリングされた後も保持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description:
UiKitModal and UiKitContextualBar are rendered with a random key:
packages/react/src/views/ChatBody/ChatBody.js:440:<UiKitModal key={Math.random()} initialView={uiKitModalData} />packages/react/src/views/ChatLayout/ChatLayout.js:173:<UiKitContextualBar key={Math.random()} ... />
Because the key changes on every render, React unmounts and remounts the surface whenever the parent re-renders (a new message arrives, the typing indicator updates, scroll state changes). Anything the user typed into an app's modal or contextual bar is lost and the surface state is reset.
Steps to reproduce:
- Install a Rocket.Chat app that opens a UIKit modal (or contextual bar) with a text input.
- Open it from EmbeddedChat and start typing in the input.
- While it is open, have another user send a message in the room (anything that re-renders ChatBody / ChatLayout).
- The modal remounts and the typed text is gone.
Expected behavior:
The modal / contextual bar keeps its state until the view itself changes.
Actual behavior:
The surface is remounted on every parent re-render and loses its input.
Suggested fix: use a stable key, the view id (key={uiKitModalData?.id} and key={uiKitContextualBarData?.id}). I'd be happy to open a PR for this.
- 主要言語
- JavaScript
- スター
- 171
- フォーク
- 421
- 平均マージ
- 3日 6時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RocketChat/EmbeddedChat のほかの issue
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migration対応中かも @MuhammadFaizan-prog が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
RocketChat/EmbeddedChat#1489 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)対応中かも @yashsarvaiya45 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
RocketChat/EmbeddedChat#1486 ·
メンテナーはふだん 1 日以内に返信
-
bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticated対応中かも @ashwanisingh011 が 1 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
RocketChat/EmbeddedChat#1484 ·
メンテナーはふだん 1 日以内に返信
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContext対応中かも @swarnendusahu10-dotcom が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RocketChat/EmbeddedChat#1482 ·
メンテナーはふだん 1 日以内に返信
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed out対応中かも @swarnendusahu10-dotcom が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
RocketChat/EmbeddedChat#1480 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
RocketChat/EmbeddedChat の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
[Docs] CONTRIBUTING.md links to retired GitHub Learning Lab and Try Git sites対応中かも @adityamukesh が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
reillywalter/win-dev-doctor#92 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100