Skip to content

Commit d3d6ff9

Browse files
committed
fix(mobile): Browser page no longer logs a duplicate key warning
The address bar and the stream view are siblings in the same fragment and both used the tab id as their key, so React warned about two children with the same key every time the page rendered a tab. On Android dev builds that shows as a red toast over the page. Prefix each key so they are unique among siblings. Both still change with the tab id, so switching tabs remounts the address bar and the stream view as before.
1 parent 5809487 commit d3d6ff9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function BrowserPreviewScreen({
169169
{tab ? (
170170
<>
171171
<BrowserAddressBar
172-
key={tab.tabId}
172+
key={`address:${tab.tabId}`}
173173
environmentId={environmentId}
174174
tab={tab}
175175
streaming={streaming}
@@ -178,7 +178,7 @@ function BrowserPreviewScreen({
178178
/>
179179
{live ? (
180180
<PreviewStreamWebView
181-
key={tab.tabId}
181+
key={`stream:${tab.tabId}`}
182182
environmentId={environmentId}
183183
threadId={threadId}
184184
tabId={tab.tabId}

0 commit comments

Comments
 (0)