Skip to content

Commit

Permalink
fix ts error for profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag committed Sep 21, 2024
1 parent 17fa56f commit 8d26048
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/entities/profiler/lib/use-profiler/use-profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type TUseProfiler = () => {
normalizeProfilerEvent: (event: ServerEvent<Profiler>) => NormalizedEvent<Profiler>
getTopFunctions: (id: EventId, params?: Record<string, string>) => Promise<ProfilerTopFunctions>
getCallGraph: (id: EventId, params?: Record<string, string>) => Promise<ProfilerCallGraph>
getFlameChart: (id: EventId, params?: Record<string, string>) => Promise<ProfileFlameChart>
getFlameChart: (id: EventId, params?: Record<string, string>) => Promise<ProfileFlameChart[]>
}

export const useProfiler: TUseProfiler = () => {
Expand Down
1 change: 1 addition & 0 deletions src/entities/profiler/ui/flame-graph/flame-graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const renderChart = async () => {
})
flameChart.render()
window.addEventListener(
'resize',
debounce(() => {
Expand Down
25 changes: 16 additions & 9 deletions src/entities/profiler/ui/profiler-page/profiler-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,23 @@ const activeEdgeStyle = computed(() => {
}
})
const clearActiveEdge = () => {
activeEdge.value = null
activeEdgePosition.value = defaultPosition
}
const setActiveEdge = (value: CallStackHoverData | undefined) => {
if (value) {
const { position, ...edge } = value || {}
activeEdge.value = edge
activeEdgePosition.value = position
} else {
activeEdge.value = null
activeEdgePosition.value = defaultPosition
if (!value) {
clearActiveEdge()
return
}
const { position, ...edge } = value || {}
activeEdge.value = edge
activeEdgePosition.value = position
return
}
const tabChange = (selectedTab: { tab: { name: string } }) => {
Expand Down Expand Up @@ -82,7 +89,7 @@ const tabChange = (selectedTab: { tab: { name: string } }) => {
:data-key="activeTab"
:payload="event.payload"
@hover="setActiveEdge"
@hide="setActiveEdge"
@hide="clearActiveEdge"
/>
</Tab>

Expand Down
2 changes: 1 addition & 1 deletion src/shared/lib/io/use-profiler-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { REST_API_URL } from "./constants";
type TUseProfilerRequests = () => {
getTopFunctions: (id: EventId, params?: Record<string, string>) => Promise<ProfilerTopFunctions>
getCallGraph: (id: EventId, params?: Record<string, string>) => Promise<ProfilerCallGraph>
getFlameChart: (id: EventId) => Promise<ProfileFlameChart>
getFlameChart: (id: EventId) => Promise<ProfileFlameChart[]>
}

enum ProfilerPartType {
Expand Down

0 comments on commit 8d26048

Please sign in to comment.