Skip to content

Commit 8bd03ab

Browse files
committed
fix bugs
1 parent 4d1cb84 commit 8bd03ab

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/react-router-devtools/src/client/hooks/useTabs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export const useTabs = () => {
1313

1414
const { Component, hideTimeline } = useMemo(() => {
1515
const tab = allTabs.find((tab) => tab.id === activeTab)
16-
return { Component: tab?.component, hideTimeline: shouldHideTimeline(tab) }
16+
return {
17+
Component: tab?.component,
18+
hideTimeline: shouldHideTimeline(tab),
19+
}
1720
}, [activeTab, allTabs])
1821

1922
return {

packages/react-router-devtools/src/client/layout/ContentPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ContentPanel = () => {
1616
activeTab === "page" && styles.layout.contentPanel.mainContentPageTab
1717
)}
1818
>
19-
{Component}
19+
{Component && <Component />}
2020
</div>
2121

2222
{!hideTimeline && (

packages/react-router-devtools/src/client/tabs/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { JSX } from "react"
1+
import type { ComponentType, JSX } from "react"
22
import { Icon } from "../components/icon/Icon.js"
33
import { NetworkTab } from "./NetworkTab.js"
44
import { PageTab } from "./PageTab.js"
@@ -10,7 +10,7 @@ export interface Tab {
1010
name: string | JSX.Element
1111
icon: JSX.Element
1212
id: string
13-
component: JSX.Element
13+
component: ComponentType
1414
hideTimeline: boolean
1515
}
1616

@@ -19,21 +19,21 @@ export const tabs = [
1919
name: "Active page",
2020
icon: <Icon size="md" name="Layers" />,
2121
id: "page",
22-
component: <PageTab />,
22+
component: PageTab,
2323
hideTimeline: false,
2424
},
2525
{
2626
name: "Routes",
2727
icon: <Icon size="md" name="GitMerge" />,
2828
id: "routes",
29-
component: <RoutesTab />,
29+
component: RoutesTab,
3030
hideTimeline: false,
3131
},
3232
{
3333
name: "Network",
3434
icon: <Icon size="md" name="Network" />,
3535
id: "network",
36-
component: <NetworkTab />,
36+
component: NetworkTab,
3737

3838
hideTimeline: true,
3939
},

0 commit comments

Comments
 (0)