@parca/profile 0.19.65 → 0.19.67
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 +8 -0
- package/dist/ProfileExplorer/index.d.ts.map +1 -1
- package/dist/ProfileExplorer/index.js +11 -10
- package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +2 -2
- package/dist/useHasProfileData.d.ts +7 -0
- package/dist/useHasProfileData.d.ts.map +1 -0
- package/dist/useHasProfileData.js +23 -0
- package/package.json +7 -7
- package/src/ProfileExplorer/index.tsx +17 -13
- package/src/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.ts +2 -2
- package/src/useHasProfileData.ts +30 -0
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.19.67](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.66...@parca/profile@0.19.67) (2025-10-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.19.66](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.65...@parca/profile@0.19.66) (2025-10-16)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.19.65](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.64...@parca/profile@0.19.65) (2025-10-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAwC,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAwC,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAW9F,UAAU,oBAAoB;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,GAAG,CAAC;IACjB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAaD,eAAO,MAAM,sBAAsB,GAAI,YAAY,MAAM,GAAG,EAAE,KAAG,MAGhE,CAAC;AAiBF,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAiB5E,CAAC;AA+TF,QAAA,MAAM,eAAe,GAAI,2CAItB,oBAAoB,KAAG,GAAG,CAAC,OAkB7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -18,9 +18,9 @@ import { Query } from '@parca/parser';
|
|
|
18
18
|
import { createStore } from '@parca/store';
|
|
19
19
|
import { capitalizeOnlyFirstLetter, safeDecode } from '@parca/utilities';
|
|
20
20
|
import { ProfileSelectionFromParams, SuffixParams } from '..';
|
|
21
|
-
import { useProfileTypes } from '../ProfileSelector';
|
|
22
21
|
import { useResetFlameGraphState } from '../ProfileView/hooks/useResetFlameGraphState';
|
|
23
22
|
import { useResetStateOnProfileTypeChange } from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
23
|
+
import { useHasProfileData } from '../useHasProfileData';
|
|
24
24
|
import { sumByToParam, useSumByFromParams } from '../useSumBy';
|
|
25
25
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
26
26
|
import ProfileExplorerSingle from './ProfileExplorerSingle';
|
|
@@ -68,13 +68,13 @@ const swapQueryParameters = (o) => {
|
|
|
68
68
|
return o;
|
|
69
69
|
};
|
|
70
70
|
const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
71
|
-
const { loading:
|
|
71
|
+
const { loading: hasProfileDataLoading, data: hasProfileData, error: hasProfileDataError, } = useHasProfileData(queryClient);
|
|
72
72
|
const { loader, noDataPrompt, onError, authenticationErrorMessage } = useParcaContext();
|
|
73
73
|
useEffect(() => {
|
|
74
|
-
if (
|
|
75
|
-
onError?.(
|
|
74
|
+
if (hasProfileDataError !== undefined && hasProfileDataError !== null) {
|
|
75
|
+
onError?.(hasProfileDataError);
|
|
76
76
|
}
|
|
77
|
-
}, [
|
|
77
|
+
}, [hasProfileDataError, onError]);
|
|
78
78
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
79
79
|
let { from_a, to_a, merge_from_a, merge_to_a, time_selection_a, compare_a, sum_by_a, from_b, to_b, merge_from_b, merge_to_b, time_selection_b, compare_b, sum_by_b, } = queryParams;
|
|
80
80
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -106,17 +106,18 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
|
106
106
|
setProfileB(profileB);
|
|
107
107
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
108
|
}, [merge_from_b, merge_to_b, selection_b]);
|
|
109
|
-
if (
|
|
109
|
+
if (hasProfileDataLoading) {
|
|
110
110
|
return _jsx(_Fragment, { children: loader });
|
|
111
111
|
}
|
|
112
|
-
if (
|
|
112
|
+
if (!hasProfileData) {
|
|
113
113
|
return _jsx(_Fragment, { children: noDataPrompt });
|
|
114
114
|
}
|
|
115
|
-
if (
|
|
116
|
-
if (authenticationErrorMessage !== undefined &&
|
|
115
|
+
if (hasProfileDataError !== undefined && hasProfileDataError !== null) {
|
|
116
|
+
if (authenticationErrorMessage !== undefined &&
|
|
117
|
+
hasProfileDataError.code === 'UNAUTHENTICATED') {
|
|
117
118
|
return _jsx(ErrorContent, { errorMessage: authenticationErrorMessage });
|
|
118
119
|
}
|
|
119
|
-
return _jsx(ErrorContent, { errorMessage: capitalizeOnlyFirstLetter(
|
|
120
|
+
return _jsx(ErrorContent, { errorMessage: capitalizeOnlyFirstLetter(hasProfileDataError.message) });
|
|
120
121
|
}
|
|
121
122
|
const sanitizedRange = sanitizeDateRange(time_selection_a, from_a, to_a);
|
|
122
123
|
time_selection_a = sanitizedRange.time_selection_a;
|
|
@@ -96,9 +96,9 @@ export const useVisibleNodes = ({ table, viewport, total, width, selectedRow, ef
|
|
|
96
96
|
valueOffset >= selectionOffsetNumber + selectionCumulativeNumber) {
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
// Size culling: Skip nodes too small to be visible (<
|
|
99
|
+
// Size culling: Skip nodes too small to be visible (< 1px width)
|
|
100
100
|
const computedWidth = (cumulative / totalNumber) * width;
|
|
101
|
-
if (computedWidth <=
|
|
101
|
+
if (computedWidth <= 1) {
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
104
|
visibleRows.push(row);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHasProfileData.d.ts","sourceRoot":"","sources":["../src/useHasProfileData.ts"],"names":[],"mappings":"AAaA,OAAO,EAAyB,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIzE,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,kBAAkB,KACzB;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAA;CAUtD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import useGrpcQuery from './useGrpcQuery';
|
|
14
|
+
export const useHasProfileData = (client) => {
|
|
15
|
+
const { data, isLoading, error } = useGrpcQuery({
|
|
16
|
+
key: ['hasProfileData'],
|
|
17
|
+
queryFn: async (signal) => {
|
|
18
|
+
const { response } = await client.hasProfileData({}, { abort: signal });
|
|
19
|
+
return response;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return { loading: isLoading, data: data?.hasData ?? false, error };
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.67",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
7
7
|
"@headlessui/react": "^1.7.19",
|
|
8
8
|
"@iconify/react": "^4.0.0",
|
|
9
|
-
"@parca/client": "0.17.
|
|
10
|
-
"@parca/components": "0.16.
|
|
9
|
+
"@parca/client": "0.17.7",
|
|
10
|
+
"@parca/components": "0.16.377",
|
|
11
11
|
"@parca/dynamicsize": "0.16.67",
|
|
12
|
-
"@parca/hooks": "0.0.
|
|
12
|
+
"@parca/hooks": "0.0.106",
|
|
13
13
|
"@parca/icons": "0.16.74",
|
|
14
14
|
"@parca/parser": "0.16.81",
|
|
15
|
-
"@parca/store": "0.16.
|
|
15
|
+
"@parca/store": "0.16.189",
|
|
16
16
|
"@parca/test-utils": "0.0.16",
|
|
17
|
-
"@parca/utilities": "0.0.
|
|
17
|
+
"@parca/utilities": "0.0.112",
|
|
18
18
|
"@popperjs/core": "^2.11.8",
|
|
19
19
|
"@protobuf-ts/runtime-rpc": "^2.5.0",
|
|
20
20
|
"@storybook/preview-api": "^8.4.3",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"access": "public",
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "d6fc66f5b1666ca285ec409857cbde72da82db62"
|
|
83
83
|
}
|
|
@@ -22,9 +22,10 @@ import {createStore} from '@parca/store';
|
|
|
22
22
|
import {capitalizeOnlyFirstLetter, safeDecode, type NavigateFunction} from '@parca/utilities';
|
|
23
23
|
|
|
24
24
|
import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
|
|
25
|
-
import {QuerySelection
|
|
25
|
+
import {QuerySelection} from '../ProfileSelector';
|
|
26
26
|
import {useResetFlameGraphState} from '../ProfileView/hooks/useResetFlameGraphState';
|
|
27
27
|
import {useResetStateOnProfileTypeChange} from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
28
|
+
import {useHasProfileData} from '../useHasProfileData';
|
|
28
29
|
import {sumByToParam, useSumByFromParams} from '../useSumBy';
|
|
29
30
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
30
31
|
import ProfileExplorerSingle from './ProfileExplorerSingle';
|
|
@@ -114,18 +115,18 @@ const ProfileExplorerApp = ({
|
|
|
114
115
|
navigateTo,
|
|
115
116
|
}: ProfileExplorerProps): JSX.Element => {
|
|
116
117
|
const {
|
|
117
|
-
loading:
|
|
118
|
-
data:
|
|
119
|
-
error:
|
|
120
|
-
} =
|
|
118
|
+
loading: hasProfileDataLoading,
|
|
119
|
+
data: hasProfileData,
|
|
120
|
+
error: hasProfileDataError,
|
|
121
|
+
} = useHasProfileData(queryClient);
|
|
121
122
|
|
|
122
123
|
const {loader, noDataPrompt, onError, authenticationErrorMessage} = useParcaContext();
|
|
123
124
|
|
|
124
125
|
useEffect(() => {
|
|
125
|
-
if (
|
|
126
|
-
onError?.(
|
|
126
|
+
if (hasProfileDataError !== undefined && hasProfileDataError !== null) {
|
|
127
|
+
onError?.(hasProfileDataError);
|
|
127
128
|
}
|
|
128
|
-
}, [
|
|
129
|
+
}, [hasProfileDataError, onError]);
|
|
129
130
|
|
|
130
131
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
131
132
|
let {
|
|
@@ -193,20 +194,23 @@ const ProfileExplorerApp = ({
|
|
|
193
194
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
195
|
}, [merge_from_b, merge_to_b, selection_b]);
|
|
195
196
|
|
|
196
|
-
if (
|
|
197
|
+
if (hasProfileDataLoading) {
|
|
197
198
|
return <>{loader}</>;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
if (
|
|
201
|
+
if (!hasProfileData) {
|
|
201
202
|
return <>{noDataPrompt}</>;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
205
|
+
if (hasProfileDataError !== undefined && hasProfileDataError !== null) {
|
|
206
|
+
if (
|
|
207
|
+
authenticationErrorMessage !== undefined &&
|
|
208
|
+
hasProfileDataError.code === 'UNAUTHENTICATED'
|
|
209
|
+
) {
|
|
206
210
|
return <ErrorContent errorMessage={authenticationErrorMessage} />;
|
|
207
211
|
}
|
|
208
212
|
|
|
209
|
-
return <ErrorContent errorMessage={capitalizeOnlyFirstLetter(
|
|
213
|
+
return <ErrorContent errorMessage={capitalizeOnlyFirstLetter(hasProfileDataError.message)} />;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
216
|
const sanitizedRange = sanitizeDateRange(time_selection_a, from_a, to_a);
|
|
@@ -151,9 +151,9 @@ export const useVisibleNodes = ({
|
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// Size culling: Skip nodes too small to be visible (<
|
|
154
|
+
// Size culling: Skip nodes too small to be visible (< 1px width)
|
|
155
155
|
const computedWidth = (cumulative / totalNumber) * width;
|
|
156
|
-
if (computedWidth <=
|
|
156
|
+
if (computedWidth <= 1) {
|
|
157
157
|
continue;
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -0,0 +1,30 @@
|
|
|
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 {HasProfileDataResponse, QueryServiceClient} from '@parca/client';
|
|
15
|
+
|
|
16
|
+
import useGrpcQuery from './useGrpcQuery';
|
|
17
|
+
|
|
18
|
+
export const useHasProfileData = (
|
|
19
|
+
client: QueryServiceClient
|
|
20
|
+
): {loading: boolean; data: boolean; error: Error | any} => {
|
|
21
|
+
const {data, isLoading, error} = useGrpcQuery<HasProfileDataResponse>({
|
|
22
|
+
key: ['hasProfileData'],
|
|
23
|
+
queryFn: async signal => {
|
|
24
|
+
const {response} = await client.hasProfileData({}, {abort: signal});
|
|
25
|
+
return response;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return {loading: isLoading, data: data?.hasData ?? false, error};
|
|
30
|
+
};
|