@parca/profile 0.19.25 → 0.19.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.d.ts.map +1 -1
  3. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +8 -0
  4. package/dist/ProfileFlameGraph/FlameGraphArrow/index.d.ts.map +1 -1
  5. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +33 -42
  6. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.d.ts +8 -0
  7. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.d.ts.map +1 -0
  8. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +70 -0
  9. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.d.ts +24 -0
  10. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.d.ts.map +1 -0
  11. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +111 -0
  12. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.d.ts +2 -1
  13. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.d.ts.map +1 -1
  14. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +11 -0
  15. package/dist/ProfileView/components/ProfileFilters/filterPresets.d.ts +1 -1
  16. package/dist/ProfileView/components/ProfileFilters/filterPresets.d.ts.map +1 -1
  17. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +2 -1
  18. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts +7 -4
  19. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts.map +1 -1
  20. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +39 -50
  21. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +1 -1
  22. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  23. package/dist/ProfileView/components/Toolbars/index.js +1 -1
  24. package/dist/ProfileView/components/ViewSelector/index.js +1 -1
  25. package/dist/styles.css +1 -1
  26. package/package.json +5 -5
  27. package/src/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.tsx +214 -200
  28. package/src/ProfileFlameGraph/FlameGraphArrow/index.tsx +90 -90
  29. package/src/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.ts +89 -0
  30. package/src/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.ts +167 -0
  31. package/src/ProfileFlameGraph/FlameGraphArrow/utils.ts +12 -1
  32. package/src/ProfileView/components/ProfileFilters/filterPresets.ts +4 -2
  33. package/src/ProfileView/components/ProfileFilters/useProfileFilters.ts +57 -76
  34. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +1 -1
  35. package/src/ProfileView/components/Toolbars/index.tsx +1 -1
  36. package/src/ProfileView/components/ViewSelector/index.tsx +1 -1
@@ -0,0 +1,89 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {useCallback, useEffect, useRef, useState} from 'react';
15
+
16
+ export interface ViewportState {
17
+ scrollTop: number;
18
+ scrollLeft: number;
19
+ containerHeight: number;
20
+ containerWidth: number;
21
+ }
22
+
23
+ export const useScrollViewport = (containerRef: React.RefObject<HTMLDivElement>): ViewportState => {
24
+ const [viewport, setViewport] = useState<ViewportState>({
25
+ scrollTop: 0,
26
+ scrollLeft: 0,
27
+ containerHeight: 0,
28
+ containerWidth: 0,
29
+ });
30
+
31
+ const throttleRef = useRef<number | null>(null);
32
+
33
+ const updateViewport = useCallback(() => {
34
+ if (containerRef.current !== null) {
35
+ const container = containerRef.current;
36
+
37
+ const newViewport = {
38
+ scrollTop: container.scrollTop,
39
+ scrollLeft: container.scrollLeft,
40
+ containerHeight: container.clientHeight,
41
+ containerWidth: container.clientWidth,
42
+ };
43
+
44
+ setViewport(newViewport);
45
+ }
46
+ }, [containerRef]);
47
+
48
+ // Throttling Strategy:
49
+ // Use requestAnimationFrame to throttle scroll events to 60fps max
50
+ // This ensures smooth performance while preventing excessive re-renders
51
+ const throttledUpdateViewport = useCallback(() => {
52
+ if (throttleRef.current !== null) {
53
+ cancelAnimationFrame(throttleRef.current);
54
+ }
55
+ throttleRef.current = requestAnimationFrame(updateViewport);
56
+ }, [updateViewport]);
57
+
58
+ useEffect(() => {
59
+ const container = containerRef.current;
60
+ if (container === null) return;
61
+
62
+ // ResizeObserver Strategy:
63
+ // Monitor container size changes (window resize, layout shifts)
64
+ // to update viewport dimensions for accurate culling calculations
65
+ const resizeObserver = new ResizeObserver(() => {
66
+ throttledUpdateViewport();
67
+ });
68
+
69
+ // Container Scroll Event Strategy:
70
+ // Use passive event listeners for better scroll performance
71
+ // Throttle with requestAnimationFrame to maintain 60fps target
72
+ container.addEventListener('scroll', throttledUpdateViewport, {passive: true});
73
+ resizeObserver.observe(container);
74
+
75
+ // Initialize viewport state on mount
76
+ updateViewport();
77
+
78
+ return () => {
79
+ // Cleanup: Remove event listeners and cancel pending animations
80
+ container.removeEventListener('scroll', throttledUpdateViewport);
81
+ resizeObserver.disconnect();
82
+ if (throttleRef.current !== null) {
83
+ cancelAnimationFrame(throttleRef.current);
84
+ }
85
+ };
86
+ }, [containerRef, throttledUpdateViewport, updateViewport]);
87
+
88
+ return viewport;
89
+ };
@@ -0,0 +1,167 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {useMemo, useRef} from 'react';
15
+
16
+ import {Table} from 'apache-arrow';
17
+
18
+ import {RowHeight} from './FlameGraphNodes';
19
+ import {FIELD_CUMULATIVE, FIELD_DEPTH, FIELD_VALUE_OFFSET} from './index';
20
+ import {ViewportState} from './useScrollViewport';
21
+ import {getMaxDepth} from './utils';
22
+
23
+ /**
24
+ * This function groups rows by their depth level.
25
+ * Instead of scanning all rows to find depth matches, we pre-compute
26
+ * buckets so viewport rendering only examines depth ranges that are relevant.
27
+ */
28
+ const useDepthBuckets = <TRow extends Record<string, any>>(
29
+ table: Table<TRow> | undefined
30
+ ): number[][] => {
31
+ return useMemo(() => {
32
+ if (table === undefined) return [];
33
+
34
+ const depthColumn = table.getChild(FIELD_DEPTH);
35
+ if (depthColumn === null) return [];
36
+
37
+ // Find max depth
38
+ const maxDepth = getMaxDepth(depthColumn);
39
+
40
+ // Create buckets for each depth level
41
+ const buckets: number[][] = Array.from({length: maxDepth + 1}, () => []);
42
+
43
+ // Populate buckets with row indices
44
+ for (let row = 0; row < table.numRows; row++) {
45
+ const depth = depthColumn.get(row) ?? 0;
46
+ buckets[depth].push(row);
47
+ }
48
+
49
+ return buckets;
50
+ }, [table]);
51
+ };
52
+
53
+ export interface UseVisibleNodesParams {
54
+ table: Table<any>;
55
+ viewport: ViewportState;
56
+ total: bigint;
57
+ width: number;
58
+ selectedRow: number;
59
+ effectiveDepth: number;
60
+ }
61
+
62
+ /**
63
+ * useVisibleNodes returns row indices visible in the current viewport through multi-stage culling.
64
+ * Combines depth buckets, horizontal bounds checking, and size filtering to
65
+ * minimize rendered nodes from potentially 100K+ rows to ~hundreds.
66
+ *
67
+ * We use depth buckets to only iterate through the rows that are visible in the viewport vertically.
68
+ * After that we use horizontal bounds checking to only iterate through the rows that are visible in the viewport horizontally.
69
+ * Finally we use size filtering to only iterate through the rows that are visible in the viewport by size.
70
+ *
71
+ * Critical for maintaining 60fps performance on large flamegraphs where
72
+ * rendering all nodes would freeze the browser.
73
+ */
74
+ export const useVisibleNodes = ({
75
+ table,
76
+ viewport,
77
+ total,
78
+ width,
79
+ selectedRow,
80
+ effectiveDepth,
81
+ }: UseVisibleNodesParams): number[] => {
82
+ const depthBuckets = useDepthBuckets(table);
83
+ const lastResultRef = useRef<{
84
+ key: string;
85
+ result: number[];
86
+ }>({key: '', result: []});
87
+
88
+ return useMemo(() => {
89
+ // Create a stable key for memoization to prevent unnecessary recalculations
90
+ const memoKey = `${viewport.scrollTop}-${viewport.containerHeight}-${selectedRow}-${effectiveDepth}-${width}`;
91
+
92
+ // Return cached result if viewport hasn't meaningfully changed
93
+ if (lastResultRef.current.key === memoKey) {
94
+ return lastResultRef.current.result;
95
+ }
96
+
97
+ if (table === null || viewport.containerHeight === 0) return [];
98
+
99
+ const visibleRows: number[] = [];
100
+ const {scrollTop, containerHeight} = viewport;
101
+
102
+ // Viewport Culling Algorithm:
103
+ // 1. Calculate visible depth range based on scroll position and container height
104
+ // 2. Add 5-row buffer above/below for smooth scrolling experience
105
+ const startDepth = Math.max(0, Math.floor(scrollTop / RowHeight) - 5);
106
+ const endDepth = Math.min(
107
+ effectiveDepth,
108
+ Math.ceil((scrollTop + containerHeight) / RowHeight) + 5
109
+ );
110
+
111
+ const cumulativeColumn = table.getChild(FIELD_CUMULATIVE);
112
+ const valueOffsetColumn = table.getChild(FIELD_VALUE_OFFSET);
113
+
114
+ const selectionOffset =
115
+ valueOffsetColumn?.get(selectedRow) !== null &&
116
+ valueOffsetColumn?.get(selectedRow) !== undefined
117
+ ? BigInt(valueOffsetColumn?.get(selectedRow))
118
+ : 0n;
119
+ const selectionCumulative =
120
+ cumulativeColumn?.get(selectedRow) !== null ? BigInt(cumulativeColumn?.get(selectedRow)) : 0n;
121
+
122
+ const totalNumber = Number(total);
123
+ const selectionOffsetNumber = Number(selectionOffset);
124
+ const selectionCumulativeNumber = Number(selectionCumulative);
125
+
126
+ // Iterate only through visible depth range instead of all rows
127
+ for (let depth = startDepth; depth <= endDepth && depth < depthBuckets.length; depth++) {
128
+ // Skip if depth is beyond effective depth limit
129
+ if (effectiveDepth !== undefined && depth > effectiveDepth) {
130
+ continue;
131
+ }
132
+
133
+ const rowsAtDepth = depthBuckets[depth];
134
+
135
+ for (const row of rowsAtDepth) {
136
+ const cumulative =
137
+ cumulativeColumn?.get(row) !== null ? Number(cumulativeColumn?.get(row)) : 0;
138
+
139
+ const valueOffset =
140
+ valueOffsetColumn?.get(row) !== null && valueOffsetColumn?.get(row) !== undefined
141
+ ? Number(valueOffsetColumn?.get(row))
142
+ : 0;
143
+
144
+ // Horizontal culling: Skip nodes outside selection bounds
145
+ if (
146
+ valueOffset + cumulative <= selectionOffsetNumber ||
147
+ valueOffset >= selectionOffsetNumber + selectionCumulativeNumber
148
+ ) {
149
+ continue;
150
+ }
151
+
152
+ // Size culling: Skip nodes too small to be visible (< 1px width)
153
+ const computedWidth = (cumulative / totalNumber) * width;
154
+ if (computedWidth <= 1) {
155
+ continue;
156
+ }
157
+
158
+ visibleRows.push(row);
159
+ }
160
+ }
161
+
162
+ // Cache the result with the current key
163
+ lastResultRef.current = {key: memoKey, result: visibleRows};
164
+
165
+ return visibleRows;
166
+ }, [depthBuckets, viewport, total, width, selectedRow, effectiveDepth, table]);
167
+ };
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import {Table} from 'apache-arrow';
14
+ import {Table, Vector} from 'apache-arrow';
15
15
 
16
16
  import {
17
17
  BINARY_FEATURE_TYPES,
@@ -203,3 +203,14 @@ export function isCurrentPathFrameMatch(
203
203
  a.labels === b.labels
204
204
  );
205
205
  }
206
+
207
+ export function getMaxDepth(depthColumn: Vector<any> | null): number {
208
+ if (depthColumn === null) return 0;
209
+
210
+ let max = 0;
211
+ for (const val of depthColumn) {
212
+ const numVal = Number(val);
213
+ if (numVal > max) max = numVal;
214
+ }
215
+ return max;
216
+ }
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import type {ProfileFilter} from '@parca/store';
14
+ import type {ProfileFilter} from './useProfileFilters';
15
15
 
16
16
  export interface FilterPreset {
17
17
  key: string;
@@ -67,8 +67,10 @@ export const filterPresets: FilterPreset[] = [
67
67
  },
68
68
  ];
69
69
 
70
+ const presetKeys = new Set(filterPresets.map(preset => preset.key));
71
+
70
72
  export const isPresetKey = (key: string): boolean => {
71
- return filterPresets.some(preset => preset.key === key);
73
+ return presetKeys.has(key);
72
74
  };
73
75
 
74
76
  export const getPresetByKey = (key: string): FilterPreset | undefined => {
@@ -11,21 +11,20 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import {useCallback, useEffect, useMemo} from 'react';
14
+ import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
15
15
 
16
16
  import {type Filter} from '@parca/client';
17
- import {
18
- selectLocalFilters,
19
- setLocalFilters,
20
- useAppDispatch,
21
- useAppSelector,
22
- type ProfileFilter,
23
- } from '@parca/store';
24
-
25
- import {getPresetByKey, isPresetKey, type FilterPreset} from './filterPresets';
17
+
18
+ import {getPresetByKey, isPresetKey} from './filterPresets';
26
19
  import {useProfileFiltersUrlState} from './useProfileFiltersUrlState';
27
20
 
28
- export type {ProfileFilter};
21
+ export interface ProfileFilter {
22
+ id: string;
23
+ type?: 'stack' | 'frame' | string; // string allows preset keys
24
+ field?: 'function_name' | 'binary' | 'system_name' | 'filename' | 'address' | 'line_number';
25
+ matchType?: 'equal' | 'not_equal' | 'contains' | 'not_contains';
26
+ value: string;
27
+ }
29
28
 
30
29
  // Convert ProfileFilter[] to protobuf Filter[] matching the expected structure
31
30
  export const convertToProtoFilters = (profileFilters: ProfileFilter[]): Filter[] => {
@@ -41,6 +40,7 @@ export const convertToProtoFilters = (profileFilters: ProfileFilter[]): Filter[]
41
40
  expandedFilters.push({
42
41
  ...presetFilter,
43
42
  id: `${filter.id}-expanded-${index}`,
43
+ value: presetFilter.value,
44
44
  });
45
45
  });
46
46
  }
@@ -142,36 +142,41 @@ export const useProfileFilters = (): {
142
142
  removeFilter: (id: string) => void;
143
143
  updateFilter: (id: string, updates: Partial<ProfileFilter>) => void;
144
144
  resetFilters: () => void;
145
- applyPreset: (preset: FilterPreset) => void;
146
145
  } => {
147
146
  const {appliedFilters, setAppliedFilters} = useProfileFiltersUrlState();
148
- const dispatch = useAppDispatch();
149
- const localFilters = useAppSelector(selectLocalFilters);
147
+
148
+ const [localFilters, setLocalFilters] = useState<ProfileFilter[]>([]);
149
+
150
+ const lastAppliedFiltersRef = useRef<ProfileFilter[]>([]);
151
+
152
+ const localFiltersRef = useRef<ProfileFilter[]>(localFilters);
153
+ localFiltersRef.current = localFilters;
150
154
 
151
155
  useEffect(() => {
152
- if (appliedFilters != null && appliedFilters.length > 0) {
153
- // Check if they're different to avoid unnecessary updates
154
- const areFiltersEqual =
155
- appliedFilters.length === localFilters.length &&
156
- appliedFilters.every((applied, index) => {
157
- const local = localFilters[index];
158
- return (
159
- local != null &&
160
- applied.type === local.type &&
161
- applied.field === local.field &&
162
- applied.matchType === local.matchType &&
163
- applied.value === local.value
164
- );
165
- });
156
+ const currentApplied = appliedFilters ?? [];
157
+ const lastApplied = lastAppliedFiltersRef.current;
158
+
159
+ // Check if appliedFilters actually changed (avoid circular updates)
160
+ const appliedChanged =
161
+ currentApplied.length !== lastApplied.length ||
162
+ currentApplied.some((applied, index) => {
163
+ const last = lastApplied[index];
164
+ return (
165
+ last == null ||
166
+ applied.type !== last.type ||
167
+ applied.field !== last.field ||
168
+ applied.matchType !== last.matchType ||
169
+ applied.value !== last.value
170
+ );
171
+ });
166
172
 
167
- if (!areFiltersEqual) {
168
- dispatch(setLocalFilters(appliedFilters));
169
- }
170
- } else if (appliedFilters != null && appliedFilters.length === 0 && localFilters.length > 0) {
171
- dispatch(setLocalFilters([]));
173
+ if (!appliedChanged) {
174
+ return;
172
175
  }
173
- // eslint-disable-next-line react-hooks/exhaustive-deps
174
- }, []);
176
+
177
+ lastAppliedFiltersRef.current = currentApplied;
178
+ setLocalFilters(currentApplied);
179
+ }, [appliedFilters]);
175
180
 
176
181
  const hasUnsavedChanges = useMemo(() => {
177
182
  const localWithValues = localFilters.filter(f => {
@@ -210,8 +215,8 @@ export const useProfileFilters = (): {
210
215
  id: `filter-${Date.now()}-${Math.random()}`,
211
216
  value: '',
212
217
  };
213
- dispatch(setLocalFilters([...localFilters, newFilter]));
214
- }, [dispatch, localFilters]);
218
+ setLocalFilters([...localFiltersRef.current, newFilter]);
219
+ }, []);
215
220
 
216
221
  const excludeBinary = useCallback(
217
222
  (binaryName: string) => {
@@ -235,13 +240,14 @@ export const useProfileFilters = (): {
235
240
  matchType: 'not_contains',
236
241
  value: binaryName,
237
242
  };
238
- dispatch(setLocalFilters([...localFilters, newFilter]));
243
+ setLocalFilters([...localFiltersRef.current, newFilter]);
239
244
 
240
245
  // Auto-apply the filter since it has a value
241
246
  const filtersToApply = [...(appliedFilters ?? []), newFilter];
242
247
  setAppliedFilters(filtersToApply);
243
248
  },
244
- [appliedFilters, setAppliedFilters, dispatch, localFilters]
249
+ // eslint-disable-next-line react-hooks/exhaustive-deps
250
+ [setAppliedFilters]
245
251
  );
246
252
 
247
253
  const removeExcludeBinary = useCallback(
@@ -263,34 +269,27 @@ export const useProfileFilters = (): {
263
269
  setAppliedFilters(updatedAppliedFilters);
264
270
 
265
271
  // Also remove from local filters
266
- const updatedLocalFilters = localFilters.filter(f => f.id !== filterToRemove.id);
267
- dispatch(setLocalFilters(updatedLocalFilters));
272
+ setLocalFilters(localFiltersRef.current.filter(f => f.id !== filterToRemove.id));
268
273
  }
269
274
  },
270
- [appliedFilters, setAppliedFilters, dispatch, localFilters]
275
+ [appliedFilters, setAppliedFilters]
271
276
  );
272
277
 
273
- const removeFilter = useCallback(
274
- (id: string) => {
275
- dispatch(setLocalFilters(localFilters.filter(f => f.id !== id)));
276
- },
277
- [dispatch, localFilters]
278
- );
278
+ const removeFilter = useCallback((id: string) => {
279
+ setLocalFilters(localFiltersRef.current.filter(f => f.id !== id));
280
+ }, []);
279
281
 
280
- const updateFilter = useCallback(
281
- (id: string, updates: Partial<ProfileFilter>) => {
282
- dispatch(setLocalFilters(localFilters.map(f => (f.id === id ? {...f, ...updates} : f))));
283
- },
284
- [dispatch, localFilters]
285
- );
282
+ const updateFilter = useCallback((id: string, updates: Partial<ProfileFilter>) => {
283
+ setLocalFilters(localFiltersRef.current.map(f => (f.id === id ? {...f, ...updates} : f)));
284
+ }, []);
286
285
 
287
286
  const resetFilters = useCallback(() => {
288
- dispatch(setLocalFilters([]));
287
+ setLocalFilters([]);
289
288
  setAppliedFilters([]);
290
- }, [dispatch, setAppliedFilters]);
289
+ }, [setAppliedFilters]);
291
290
 
292
291
  const onApplyFilters = useCallback((): void => {
293
- const validFilters = localFilters.filter(f => {
292
+ const validFilters = localFiltersRef.current.filter(f => {
294
293
  // For preset filters, only need type and value
295
294
  if (f.type != null && isPresetKey(f.type)) {
296
295
  return f.value !== '' && f.type != null;
@@ -305,29 +304,12 @@ export const useProfileFilters = (): {
305
304
  }));
306
305
 
307
306
  setAppliedFilters(filtersToApply);
308
- }, [localFilters, setAppliedFilters]);
307
+ }, [setAppliedFilters]);
309
308
 
310
309
  const protoFilters = useMemo(() => {
311
310
  return convertToProtoFilters(appliedFilters ?? []);
312
311
  }, [appliedFilters]);
313
312
 
314
- const applyPreset = useCallback(
315
- (preset: FilterPreset) => {
316
- const presetFilter: ProfileFilter = {
317
- id: `filter-preset-${Date.now()}`,
318
- type: preset.key,
319
- value: preset.name,
320
- };
321
-
322
- // Add preset filter to existing filters
323
- const updatedFilters = [...localFilters, presetFilter];
324
- dispatch(setLocalFilters(updatedFilters));
325
-
326
- setAppliedFilters(updatedFilters);
327
- },
328
- [dispatch, setAppliedFilters, localFilters]
329
- );
330
-
331
313
  return {
332
314
  localFilters,
333
315
  appliedFilters,
@@ -340,6 +322,5 @@ export const useProfileFilters = (): {
340
322
  removeFilter,
341
323
  updateFilter,
342
324
  resetFilters,
343
- applyPreset,
344
325
  };
345
326
  };
@@ -12,9 +12,9 @@
12
12
  // limitations under the License.
13
13
 
14
14
  import {useURLStateCustom, type ParamValueSetterCustom} from '@parca/components';
15
- import {type ProfileFilter} from '@parca/store';
16
15
 
17
16
  import {isPresetKey} from './filterPresets';
17
+ import {type ProfileFilter} from './useProfileFilters';
18
18
 
19
19
  // Compact encoding mappings
20
20
  const TYPE_MAP: Record<string, string> = {
@@ -154,7 +154,7 @@ export const VisualisationToolbar: FC<VisualisationToolbarProps> = ({
154
154
 
155
155
  return (
156
156
  <>
157
- <div className="flex w-full justify-between items-end">
157
+ <div className="flex w-full justify-between items-end gap-2">
158
158
  <div className="flex gap-2 items-end">
159
159
  {isGraphViz && (
160
160
  <>
@@ -88,7 +88,7 @@ const ViewSelector = ({profileSource}: Props): JSX.Element => {
88
88
  supportingText?: string;
89
89
  }): DropdownElement => {
90
90
  const title = (
91
- <span className="capitalize">
91
+ <span className="capitalize whitespace-nowrap">
92
92
  {typeof label === 'string' ? label.replaceAll('-', ' ') : label}
93
93
  </span>
94
94
  );