@parca/profile 0.16.243 → 0.16.244

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.16.244](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.243...@parca/profile@0.16.244) (2023-09-01)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.16.243](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.242...@parca/profile@0.16.243) (2023-09-01)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -4,7 +4,7 @@ import { Flamegraph } from '@parca/client';
4
4
  import { type NavigateFunction } from '@parca/utilities';
5
5
  export type ResizeHandler = (width: number, height: number) => void;
6
6
  interface ProfileIcicleGraphProps {
7
- width?: number;
7
+ width: number;
8
8
  graph?: Flamegraph;
9
9
  table?: Table<any>;
10
10
  total: bigint;
@@ -17,5 +17,5 @@ interface ProfileIcicleGraphProps {
17
17
  setActionButtons?: (buttons: React.JSX.Element) => void;
18
18
  error?: any;
19
19
  }
20
- declare const ProfileIcicleGraph: ({ graph, table, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, error, }: ProfileIcicleGraphProps) => JSX.Element;
20
+ declare const ProfileIcicleGraph: ({ graph, table, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, error, width, }: ProfileIcicleGraphProps) => JSX.Element;
21
21
  export default ProfileIcicleGraph;
@@ -15,7 +15,6 @@ import { Fragment, useCallback, useEffect, useMemo } from 'react';
15
15
  import { Menu, Transition } from '@headlessui/react';
16
16
  import { Icon } from '@iconify/react';
17
17
  import { Button, Select, useParcaContext, useURLState } from '@parca/components';
18
- import { useContainerDimensions } from '@parca/hooks';
19
18
  import { divide, selectQueryParam } from '@parca/utilities';
20
19
  import DiffLegend from '../components/DiffLegend';
21
20
  import IcicleGraph from './IcicleGraph';
@@ -50,10 +49,9 @@ const GroupAndSortActionButtons = ({ navigateTo }) => {
50
49
  }, [groupBy, setGroupBy]);
51
50
  return (_jsxs(_Fragment, { children: [_jsx(GroupByDropdown, { groupBy: groupBy, toggleGroupBy: toggleGroupBy }), _jsx(SortBySelect, { compareMode: compareMode, sortBy: storeSortBy, setSortBy: setStoreSortBy })] }));
52
51
  };
53
- const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ graph, table, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, error, }) {
52
+ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ graph, table, total, filtered, curPath, setNewCurPath, sampleUnit, navigateTo, loading, setActionButtons, error, width, }) {
54
53
  const { loader } = useParcaContext();
55
54
  const compareMode = selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
56
- const { ref, dimensions } = useContainerDimensions();
57
55
  const [storeSortBy = FIELD_FUNCTION_NAME] = useURLState({
58
56
  param: 'sort_by',
59
57
  navigateTo,
@@ -97,7 +95,7 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({ graph, table, to
97
95
  if (isTrimmed) {
98
96
  console.info(`Trimmed ${trimmedFormatted} (${trimmedPercentage}%) too small values.`);
99
97
  }
100
- return (_jsxs("div", { className: "relative", children: [compareMode && _jsx(DiffLegend, {}), _jsxs("div", { ref: ref, className: "min-h-48", children: [graph !== undefined && (_jsx(IcicleGraph, { width: dimensions?.width, graph: graph, total: total, filtered: filtered, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo })), table !== undefined && (_jsx(IcicleGraphArrow, { width: dimensions?.width, table: table, total: total, filtered: filtered, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo, sortBy: storeSortBy }))] }), _jsxs("p", { className: "my-2 text-xs", children: ["Showing ", totalFormatted, ' ', isFiltered ? (_jsxs("span", { children: ["(", filteredPercentage, "%) filtered of ", totalUnfilteredFormatted, ' '] })) : (_jsx(_Fragment, {})), "values.", ' '] })] }));
98
+ return (_jsxs("div", { className: "relative", children: [compareMode && _jsx(DiffLegend, {}), _jsxs("div", { className: "min-h-48", children: [graph !== undefined && (_jsx(IcicleGraph, { width: width, graph: graph, total: total, filtered: filtered, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo })), table !== undefined && (_jsx(IcicleGraphArrow, { width: width, table: table, total: total, filtered: filtered, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo, sortBy: storeSortBy }))] }), _jsxs("p", { className: "my-2 text-xs", children: ["Showing ", totalFormatted, ' ', isFiltered ? (_jsxs("span", { children: ["(", filteredPercentage, "%) filtered of ", totalUnfilteredFormatted, ' '] })) : (_jsx(_Fragment, {})), "values.", ' '] })] }));
101
99
  };
102
100
  const groupByOptions = [
103
101
  {
@@ -130,7 +130,11 @@ export const ProfileView = ({ total, filtered, flamegraphData, topTableData, cal
130
130
  return (_jsx(ConditionalWrapper, { condition: perf?.onRender != null, WrapperComponent: Profiler, wrapperProps: {
131
131
  id: 'icicleGraph',
132
132
  onRender: perf?.onRender,
133
- }, children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, table: flamegraphData?.table, graph: flamegraphData?.data, total: total, filtered: filtered, sampleUnit: sampleUnit, navigateTo: navigateTo, loading: flamegraphData.loading, setActionButtons: setActionButtons, error: flamegraphData.error }) }));
133
+ }, children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, table: flamegraphData?.table, graph: flamegraphData?.data, total: total, filtered: filtered, sampleUnit: sampleUnit, navigateTo: navigateTo, loading: flamegraphData.loading, setActionButtons: setActionButtons, error: flamegraphData.error, width: dimensions?.width !== undefined
134
+ ? isHalfScreen
135
+ ? (dimensions.width - 40) / 2
136
+ : dimensions.width - 16
137
+ : 0 }) }));
134
138
  }
135
139
  case 'callgraph': {
136
140
  return callgraphData?.data !== undefined &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.243",
3
+ "version": "0.16.244",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.86",
@@ -49,5 +49,5 @@
49
49
  "access": "public",
50
50
  "registry": "https://registry.npmjs.org/"
51
51
  },
52
- "gitHead": "fef627c0af7b6169048f9108637cdc92442ad4ae"
52
+ "gitHead": "cad92c30fc37a648d8989db61aaa8165b1db4028"
53
53
  }
@@ -19,7 +19,6 @@ import {Table} from 'apache-arrow';
19
19
 
20
20
  import {Flamegraph} from '@parca/client';
21
21
  import {Button, Select, useParcaContext, useURLState} from '@parca/components';
22
- import {useContainerDimensions} from '@parca/hooks';
23
22
  import {divide, selectQueryParam, type NavigateFunction} from '@parca/utilities';
24
23
 
25
24
  import DiffLegend from '../components/DiffLegend';
@@ -36,7 +35,7 @@ const numberFormatter = new Intl.NumberFormat('en-US');
36
35
  export type ResizeHandler = (width: number, height: number) => void;
37
36
 
38
37
  interface ProfileIcicleGraphProps {
39
- width?: number;
38
+ width: number;
40
39
  graph?: Flamegraph;
41
40
  table?: Table<any>;
42
41
  total: bigint;
@@ -113,11 +112,11 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({
113
112
  loading,
114
113
  setActionButtons,
115
114
  error,
115
+ width,
116
116
  }: ProfileIcicleGraphProps): JSX.Element {
117
117
  const {loader} = useParcaContext();
118
118
  const compareMode: boolean =
119
119
  selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
120
- const {ref, dimensions} = useContainerDimensions();
121
120
 
122
121
  const [storeSortBy = FIELD_FUNCTION_NAME] = useURLState({
123
122
  param: 'sort_by',
@@ -200,10 +199,10 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({
200
199
  return (
201
200
  <div className="relative">
202
201
  {compareMode && <DiffLegend />}
203
- <div ref={ref} className="min-h-48">
202
+ <div className="min-h-48">
204
203
  {graph !== undefined && (
205
204
  <IcicleGraph
206
- width={dimensions?.width}
205
+ width={width}
207
206
  graph={graph}
208
207
  total={total}
209
208
  filtered={filtered}
@@ -215,7 +214,7 @@ const ProfileIcicleGraph = function ProfileIcicleGraphNonMemo({
215
214
  )}
216
215
  {table !== undefined && (
217
216
  <IcicleGraphArrow
218
- width={dimensions?.width}
217
+ width={width}
219
218
  table={table}
220
219
  total={total}
221
220
  filtered={filtered}
@@ -267,6 +267,13 @@ export const ProfileView = ({
267
267
  loading={flamegraphData.loading}
268
268
  setActionButtons={setActionButtons}
269
269
  error={flamegraphData.error}
270
+ width={
271
+ dimensions?.width !== undefined
272
+ ? isHalfScreen
273
+ ? (dimensions.width - 40) / 2
274
+ : dimensions.width - 16
275
+ : 0
276
+ }
270
277
  />
271
278
  </ConditionalWrapper>
272
279
  );