@parca/profile 0.19.58 → 0.19.59

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.19.59](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.58...@parca/profile@0.19.59) (2025-09-30)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.19.58](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.57...@parca/profile@0.19.58) (2025-09-26)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -26,7 +26,7 @@ export const useLabelNames = (client, profileType, start, end, match) => {
26
26
  const metadata = useGrpcMetadata();
27
27
  const { data, isLoading, error } = useGrpcQuery({
28
28
  key: ['labelNames', profileType, match?.join(','), start, end],
29
- queryFn: async () => {
29
+ queryFn: async (signal) => {
30
30
  const request = { match: match !== undefined ? match : [] };
31
31
  if (start !== undefined && end !== undefined) {
32
32
  request.start = millisToProtoTimestamp(start);
@@ -35,7 +35,7 @@ export const useLabelNames = (client, profileType, start, end, match) => {
35
35
  if (profileType !== undefined) {
36
36
  request.profileType = profileType;
37
37
  }
38
- const { response } = await client.labels(request, { meta: metadata });
38
+ const { response } = await client.labels(request, { meta: metadata, abort: signal });
39
39
  return response;
40
40
  },
41
41
  options: {
@@ -50,13 +50,13 @@ export const useLabelValues = (client, labelName, profileType, start, end) => {
50
50
  const metadata = useGrpcMetadata();
51
51
  const { data, isLoading, error } = useGrpcQuery({
52
52
  key: ['labelValues', labelName, profileType, start, end],
53
- queryFn: async () => {
53
+ queryFn: async (signal) => {
54
54
  const request = { labelName, match: [], profileType };
55
55
  if (start !== undefined && end !== undefined) {
56
56
  request.start = millisToProtoTimestamp(start);
57
57
  request.end = millisToProtoTimestamp(end);
58
58
  }
59
- const { response } = await client.values(request, { meta: metadata });
59
+ const { response } = await client.values(request, { meta: metadata, abort: signal });
60
60
  return sanitizeLabelValue(response.labelValues);
61
61
  },
62
62
  options: {
@@ -42,7 +42,7 @@ export const useQueryRange = (client, queryExpression, start, end, sumBy, skip =
42
42
  }, [stepCountStr, defaultStepCount, setStepCount]);
43
43
  const { data, isLoading, error } = useGrpcQuery({
44
44
  key: ['query-range', queryExpression, start, end, (sumBy ?? []).join(','), stepCount, metadata],
45
- queryFn: async () => {
45
+ queryFn: async (signal) => {
46
46
  const stepDuration = getStepDuration(start, end, stepCount);
47
47
  const { response } = await client.queryRange({
48
48
  query: queryExpression,
@@ -51,7 +51,7 @@ export const useQueryRange = (client, queryExpression, start, end, sumBy, skip =
51
51
  step: Duration.create(stepDuration),
52
52
  limit: 0,
53
53
  sumBy,
54
- }, { meta: metadata });
54
+ }, { meta: metadata, abort: signal });
55
55
  return response;
56
56
  },
57
57
  options: {
@@ -1,7 +1,7 @@
1
1
  import { type UseQueryResult } from '@tanstack/react-query';
2
2
  interface Props<IRes> {
3
3
  key: unknown[];
4
- queryFn: () => Promise<IRes>;
4
+ queryFn: (signal?: AbortSignal) => Promise<IRes>;
5
5
  options?: {
6
6
  enabled?: boolean | undefined;
7
7
  staleTime?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useGrpcQuery/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAW,KAAK,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAEpE,UAAU,KAAK,CAAC,IAAI;IAClB,GAAG,EAAE,OAAO,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QACzB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACxC,CAAC;CACH;AAED,QAAA,MAAM,YAAY,GAAI,IAAI,EAAE,6EAIzB,KAAK,CAAC,IAAI,CAAC,KAAG,cAAc,CAAC,IAAI,CAanC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useGrpcQuery/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAW,KAAK,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAEpE,UAAU,KAAK,CAAC,IAAI;IAClB,GAAG,EAAE,OAAO,EAAE,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QACzB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACxC,CAAC;CACH;AAED,QAAA,MAAM,YAAY,GAAI,IAAI,EAAE,6EAIzB,KAAK,CAAC,IAAI,CAAC,KAAG,cAAc,CAAC,IAAI,CAanC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -12,8 +12,8 @@
12
12
  // limitations under the License.
13
13
  import { useQuery } from '@tanstack/react-query';
14
14
  const useGrpcQuery = ({ key, queryFn, options: { enabled = true, staleTime, retry, keepPreviousData } = {}, }) => {
15
- return useQuery(key, async () => {
16
- return await queryFn();
15
+ return useQuery(key, async ({ signal }) => {
16
+ return await queryFn(signal);
17
17
  }, {
18
18
  enabled,
19
19
  staleTime,
package/dist/useQuery.js CHANGED
@@ -33,7 +33,7 @@ export const useQuery = (client, profileSource, reportType, options) => {
33
33
  options?.sandwichByFunction ?? '',
34
34
  protoFiltersKey,
35
35
  ],
36
- queryFn: async () => {
36
+ queryFn: async (signal) => {
37
37
  const req = profileSource.QueryRequest();
38
38
  req.reportType = reportType;
39
39
  req.nodeTrimThreshold = options?.nodeTrimThreshold;
@@ -56,7 +56,7 @@ export const useQuery = (client, profileSource, reportType, options) => {
56
56
  req.sandwichByFunction = options.sandwichByFunction;
57
57
  }
58
58
  try {
59
- const { response } = await client.query(req, { meta: metadata });
59
+ const { response } = await client.query(req, { meta: metadata, abort: signal });
60
60
  return response;
61
61
  }
62
62
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.19.58",
3
+ "version": "0.19.59",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@floating-ui/react": "^0.27.12",
@@ -79,5 +79,5 @@
79
79
  "access": "public",
80
80
  "registry": "https://registry.npmjs.org/"
81
81
  },
82
- "gitHead": "dab7c33188a3bc8408353d58f0a0f42c13a0bb4d"
82
+ "gitHead": "b3966502b60cce3330a8a3ae0ba7b4e20d4d0ea3"
83
83
  }
@@ -59,7 +59,7 @@ export const useLabelNames = (
59
59
 
60
60
  const {data, isLoading, error} = useGrpcQuery<LabelsResponse>({
61
61
  key: ['labelNames', profileType, match?.join(','), start, end],
62
- queryFn: async () => {
62
+ queryFn: async signal => {
63
63
  const request: LabelsRequest = {match: match !== undefined ? match : []};
64
64
  if (start !== undefined && end !== undefined) {
65
65
  request.start = millisToProtoTimestamp(start);
@@ -68,7 +68,7 @@ export const useLabelNames = (
68
68
  if (profileType !== undefined) {
69
69
  request.profileType = profileType;
70
70
  }
71
- const {response} = await client.labels(request, {meta: metadata});
71
+ const {response} = await client.labels(request, {meta: metadata, abort: signal});
72
72
  return response;
73
73
  },
74
74
  options: {
@@ -100,13 +100,13 @@ export const useLabelValues = (
100
100
 
101
101
  const {data, isLoading, error} = useGrpcQuery<string[]>({
102
102
  key: ['labelValues', labelName, profileType, start, end],
103
- queryFn: async () => {
103
+ queryFn: async signal => {
104
104
  const request: ValuesRequest = {labelName, match: [], profileType};
105
105
  if (start !== undefined && end !== undefined) {
106
106
  request.start = millisToProtoTimestamp(start);
107
107
  request.end = millisToProtoTimestamp(end);
108
108
  }
109
- const {response} = await client.values(request, {meta: metadata});
109
+ const {response} = await client.values(request, {meta: metadata, abort: signal});
110
110
  return sanitizeLabelValue(response.labelValues);
111
111
  },
112
112
  options: {
@@ -68,7 +68,7 @@ export const useQueryRange = (
68
68
 
69
69
  const {data, isLoading, error} = useGrpcQuery<QueryRangeResponse | undefined>({
70
70
  key: ['query-range', queryExpression, start, end, (sumBy ?? []).join(','), stepCount, metadata],
71
- queryFn: async () => {
71
+ queryFn: async signal => {
72
72
  const stepDuration = getStepDuration(start, end, stepCount);
73
73
  const {response} = await client.queryRange(
74
74
  {
@@ -79,7 +79,7 @@ export const useQueryRange = (
79
79
  limit: 0,
80
80
  sumBy,
81
81
  },
82
- {meta: metadata}
82
+ {meta: metadata, abort: signal}
83
83
  );
84
84
  return response;
85
85
  },
@@ -15,7 +15,7 @@ import {useQuery, type UseQueryResult} from '@tanstack/react-query';
15
15
 
16
16
  interface Props<IRes> {
17
17
  key: unknown[];
18
- queryFn: () => Promise<IRes>;
18
+ queryFn: (signal?: AbortSignal) => Promise<IRes>;
19
19
  options?: {
20
20
  enabled?: boolean | undefined;
21
21
  staleTime?: number | undefined;
@@ -31,8 +31,8 @@ const useGrpcQuery = <IRes>({
31
31
  }: Props<IRes>): UseQueryResult<IRes> => {
32
32
  return useQuery<IRes>(
33
33
  key,
34
- async () => {
35
- return await queryFn();
34
+ async ({signal}) => {
35
+ return await queryFn(signal);
36
36
  },
37
37
  {
38
38
  enabled,
package/src/useQuery.tsx CHANGED
@@ -66,7 +66,7 @@ export const useQuery = (
66
66
  options?.sandwichByFunction ?? '',
67
67
  protoFiltersKey,
68
68
  ],
69
- queryFn: async () => {
69
+ queryFn: async signal => {
70
70
  const req = profileSource.QueryRequest();
71
71
  req.reportType = reportType;
72
72
  req.nodeTrimThreshold = options?.nodeTrimThreshold;
@@ -91,7 +91,7 @@ export const useQuery = (
91
91
  }
92
92
 
93
93
  try {
94
- const {response} = await client.query(req, {meta: metadata});
94
+ const {response} = await client.query(req, {meta: metadata, abort: signal});
95
95
  return response;
96
96
  } catch (e) {
97
97
  if (options?.sourceOnly === true) {