@parca/profile 0.19.14 → 0.19.15
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 +4 -0
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +17 -1
- package/package.json +2 -2
- package/src/useSumBy.ts +18 -1
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.19.15](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.14...@parca/profile@0.19.15) (2025-07-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.19.14](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.13...@parca/profile@0.19.14) (2025-07-08)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @parca/profile
|
package/dist/useSumBy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSumBy.d.ts","sourceRoot":"","sources":["../src/useSumBy.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAO,CAAC;AA6BjD,eAAO,MAAM,iBAAiB,gBACf,WAAW,GAAG,SAAS,qBACjB,OAAO,UAClB,MAAM,EAAE,GAAG,SAAS,sBAGzB;IACD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,KACA,CACD,MAAM,EAAE,GAAG,SAAS,EACpB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,EAC1B;IACE,SAAS,EAAE,OAAO,CAAC;CACpB,
|
|
1
|
+
{"version":3,"file":"useSumBy.d.ts","sourceRoot":"","sources":["../src/useSumBy.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAO,CAAC;AA6BjD,eAAO,MAAM,iBAAiB,gBACf,WAAW,GAAG,SAAS,qBACjB,OAAO,UAClB,MAAM,EAAE,GAAG,SAAS,sBAGzB;IACD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,KACA,CACD,MAAM,EAAE,GAAG,SAAS,EACpB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,EAC1B;IACE,SAAS,EAAE,OAAO,CAAC;CACpB,CAgDF,CAAC;AAEF,eAAO,MAAM,eAAe,gBACb,WAAW,GAAG,SAAS,qBACjB,OAAO,UAClB,MAAM,EAAE,GAAG,SAAS,KAC3B;IAAC,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAMzD,CAAC;AAyBF,eAAO,MAAM,kBAAkB,UAAW,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM,EAAE,GAAG,SAMpF,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAU9E,CAAC"}
|
package/dist/useSumBy.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
13
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
14
14
|
export const DEFAULT_EMPTY_SUM_BY = [];
|
|
15
15
|
const getDefaultSumBy = (profile, labels) => {
|
|
16
16
|
if (profile === undefined || labels === undefined) {
|
|
@@ -32,6 +32,15 @@ const getDefaultSumBy = (profile, labels) => {
|
|
|
32
32
|
};
|
|
33
33
|
export const useSumBySelection = (profileType, labelNamesLoading, labels, { defaultValue, } = {}) => {
|
|
34
34
|
const [userSelectedSumBy, setUserSelectedSumBy] = useState(profileType != null ? { [profileType.toString()]: defaultValue } : {});
|
|
35
|
+
// Update userSelectedSumBy when defaultValue changes (e.g., during navigation)
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (profileType != null && defaultValue !== undefined) {
|
|
38
|
+
setUserSelectedSumBy(prev => ({
|
|
39
|
+
...prev,
|
|
40
|
+
[profileType.toString()]: defaultValue,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}, [profileType, defaultValue]);
|
|
35
44
|
const setSumBy = useCallback((sumBy) => {
|
|
36
45
|
setUserSelectedSumBy(prev => {
|
|
37
46
|
if (profileType == null) {
|
|
@@ -70,6 +79,13 @@ const getSumByFromParam = (param) => {
|
|
|
70
79
|
return [];
|
|
71
80
|
}
|
|
72
81
|
if (typeof param === 'string') {
|
|
82
|
+
// Handle comma-separated strings (e.g., "comm,node" -> ["comm", "node"])
|
|
83
|
+
if (param.includes(',')) {
|
|
84
|
+
return param
|
|
85
|
+
.split(',')
|
|
86
|
+
.map(s => s.trim())
|
|
87
|
+
.filter(s => s.length > 0);
|
|
88
|
+
}
|
|
73
89
|
return [param];
|
|
74
90
|
}
|
|
75
91
|
return param;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.15",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"access": "public",
|
|
79
79
|
"registry": "https://registry.npmjs.org/"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "571cc1040322b59ee01982735f37495f23cf7ac3"
|
|
82
82
|
}
|
package/src/useSumBy.ts
CHANGED
|
@@ -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 {useCallback, useMemo, useState} from 'react';
|
|
14
|
+
import {useCallback, useEffect, useMemo, useState} from 'react';
|
|
15
15
|
|
|
16
16
|
import {ProfileType} from '@parca/parser';
|
|
17
17
|
|
|
@@ -64,6 +64,16 @@ export const useSumBySelection = (
|
|
|
64
64
|
profileType != null ? {[profileType.toString()]: defaultValue} : {}
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
+
// Update userSelectedSumBy when defaultValue changes (e.g., during navigation)
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (profileType != null && defaultValue !== undefined) {
|
|
70
|
+
setUserSelectedSumBy(prev => ({
|
|
71
|
+
...prev,
|
|
72
|
+
[profileType.toString()]: defaultValue,
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}, [profileType, defaultValue]);
|
|
76
|
+
|
|
67
77
|
const setSumBy = useCallback(
|
|
68
78
|
(sumBy: string[]) => {
|
|
69
79
|
setUserSelectedSumBy(prev => {
|
|
@@ -120,6 +130,13 @@ const getSumByFromParam = (param: string | string[] | undefined): string[] | und
|
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
if (typeof param === 'string') {
|
|
133
|
+
// Handle comma-separated strings (e.g., "comm,node" -> ["comm", "node"])
|
|
134
|
+
if (param.includes(',')) {
|
|
135
|
+
return param
|
|
136
|
+
.split(',')
|
|
137
|
+
.map(s => s.trim())
|
|
138
|
+
.filter(s => s.length > 0);
|
|
139
|
+
}
|
|
123
140
|
return [param];
|
|
124
141
|
}
|
|
125
142
|
|