@parca/profile 0.16.205 → 0.16.207

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,14 @@
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.207](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.206...@parca/profile@0.16.207) (2023-07-12)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## 0.16.206 (2023-07-12)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.205](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.204...@parca/profile@0.16.205) (2023-07-10)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -11,14 +11,16 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { useWindowSize } from 'react-use';
14
+ import { useParcaContext } from '@parca/components';
14
15
  const maxHeight = 402;
15
16
  const margin = 50;
16
- const heightStyle = `min(${maxHeight + margin}px, 47vw - 24px)`;
17
17
  export const useMetricsGraphDimensions = () => {
18
18
  let { width } = useWindowSize();
19
- width = width - 58;
19
+ const { profileExplorer } = useParcaContext();
20
+ width = width - profileExplorer.PaddingX;
20
21
  const height = Math.min(width / 2.5, maxHeight);
21
22
  const marginRight = 20;
23
+ const heightStyle = `min(${maxHeight + margin}px, ${profileExplorer.metricsGraph.maxHeightStyle})`;
22
24
  return {
23
25
  width,
24
26
  height,
@@ -69,7 +69,17 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ table, row, map
69
69
  // TODO: Support fallthrough to comparing addresses or something
70
70
  const afn = functionNameColumn?.get(a);
71
71
  const bfn = functionNameColumn?.get(b);
72
- return afn.localeCompare(bfn);
72
+ if (afn !== null && bfn !== null) {
73
+ return afn.localeCompare(bfn);
74
+ }
75
+ if (afn === null && bfn !== null) {
76
+ return -1;
77
+ }
78
+ if (afn !== null && bfn === null) {
79
+ return 1;
80
+ }
81
+ // both are null
82
+ return 0;
73
83
  });
74
84
  break;
75
85
  case FIELD_CUMULATIVE:
@@ -87,10 +97,10 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ table, row, map
87
97
  return Number(bDiff - aDiff);
88
98
  }
89
99
  if (aDiff === null && bDiff !== null) {
90
- return 1;
100
+ return -1;
91
101
  }
92
102
  if (aDiff !== null && bDiff === null) {
93
- return -1;
103
+ return 1;
94
104
  }
95
105
  // both are null
96
106
  return 0;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.205",
3
+ "version": "0.16.207",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.79",
7
- "@parca/components": "^0.16.165",
7
+ "@parca/components": "^0.16.166",
8
8
  "@parca/dynamicsize": "^0.16.54",
9
9
  "@parca/hooks": "^0.0.14",
10
10
  "@parca/parser": "^0.16.55",
@@ -47,5 +47,5 @@
47
47
  "access": "public",
48
48
  "registry": "https://registry.npmjs.org/"
49
49
  },
50
- "gitHead": "adbbf003396177b295f5c5ad4c2fe228ee9ed3ae"
50
+ "gitHead": "ea0e797162e7c016e3fed2ae6899958585b037b8"
51
51
  }
@@ -13,6 +13,8 @@
13
13
 
14
14
  import {useWindowSize} from 'react-use';
15
15
 
16
+ import {useParcaContext} from '@parca/components';
17
+
16
18
  interface MetricsGraphDimensions {
17
19
  width: number;
18
20
  height: number;
@@ -24,14 +26,16 @@ interface MetricsGraphDimensions {
24
26
  const maxHeight = 402;
25
27
  const margin = 50;
26
28
 
27
- const heightStyle = `min(${maxHeight + margin}px, 47vw - 24px)`;
28
-
29
29
  export const useMetricsGraphDimensions = (): MetricsGraphDimensions => {
30
30
  let {width} = useWindowSize();
31
- width = width - 58;
31
+ const {profileExplorer} = useParcaContext();
32
+ width = width - profileExplorer.PaddingX;
32
33
 
33
34
  const height = Math.min(width / 2.5, maxHeight);
34
35
  const marginRight = 20;
36
+ const heightStyle = `min(${maxHeight + margin}px, ${
37
+ profileExplorer.metricsGraph.maxHeightStyle
38
+ })`;
35
39
  return {
36
40
  width,
37
41
  height,
@@ -190,9 +190,19 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({
190
190
  case FIELD_FUNCTION_NAME:
191
191
  childRows.sort((a, b) => {
192
192
  // TODO: Support fallthrough to comparing addresses or something
193
- const afn: string = functionNameColumn?.get(a);
194
- const bfn: string = functionNameColumn?.get(b);
195
- return afn.localeCompare(bfn);
193
+ const afn: string | null = functionNameColumn?.get(a);
194
+ const bfn: string | null = functionNameColumn?.get(b);
195
+ if (afn !== null && bfn !== null) {
196
+ return afn.localeCompare(bfn);
197
+ }
198
+ if (afn === null && bfn !== null) {
199
+ return -1;
200
+ }
201
+ if (afn !== null && bfn === null) {
202
+ return 1;
203
+ }
204
+ // both are null
205
+ return 0;
196
206
  });
197
207
  break;
198
208
  case FIELD_CUMULATIVE:
@@ -210,10 +220,10 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({
210
220
  return Number(bDiff - aDiff);
211
221
  }
212
222
  if (aDiff === null && bDiff !== null) {
213
- return 1;
223
+ return -1;
214
224
  }
215
225
  if (aDiff !== null && bDiff === null) {
216
- return -1;
226
+ return 1;
217
227
  }
218
228
  // both are null
219
229
  return 0;