@parca/profile 0.19.82 → 0.19.84

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,16 @@
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.84](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.83...@parca/profile@0.19.84) (2025-11-27)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.19.83](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.82...@parca/profile@0.19.83) (2025-11-26)
11
+
12
+ ### Reverts
13
+
14
+ - Revert "Refactor ProfileSelector and MetricsGraphSection components (#6025)" (#6072) ([4dcbafb](https://github.com/parca-dev/parca/commit/4dcbafb3757dca64e2ce4f7a111208ca7ee88355)), closes [#6025](https://github.com/parca-dev/parca/issues/6025) [#6072](https://github.com/parca-dev/parca/issues/6072)
15
+
6
16
  ## 0.19.82 (2025-11-26)
7
17
 
8
18
  **Note:** Version bump only for package @parca/profile
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileSelector/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAoD,MAAM,OAAO,CAAC;AAElG,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAsB,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAY5F,OAAO,EAAyB,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAY/E,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAA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ProfileSelector = ({ queryClient, closeProfile, enforcedProfileName, compa
52
52
  const [queryBrowserMode, setQueryBrowserMode] = useURLState('query_browser_mode');
53
53
  const batchUpdates = useURLStateBatch();
54
54
  // Use the new useQueryState hook - reads directly from URL params
55
- const { querySelection, draftSelection, setDraftExpression, setDraftTimeRange, setDraftSumBy, setDraftProfileName, setDraftMatchers, commitDraft, profileSelection, setProfileSelection, sumByLoading, } = useQueryState({ suffix });
55
+ const { querySelection, draftSelection, setDraftExpression, setDraftTimeRange, setDraftSumBy, setDraftProfileName, setDraftMatchers, commitDraft, profileSelection, setProfileSelection, sumByLoading, draftParsedQuery, } = useQueryState({ suffix });
56
56
  // Use draft state for local state instead of committed state
57
57
  const [timeRangeSelection, setTimeRangeSelection] = useState(DateTimeRange.fromRangeKey(draftSelection.timeSelection, draftSelection.from, draftSelection.to));
58
58
  const [queryExpressionString, setQueryExpressionString] = useState(draftSelection.expression);
@@ -101,6 +101,7 @@ const ProfileSelector = ({ queryClient, closeProfile, enforcedProfileName, compa
101
101
  const currentTo = timeRangeSelection.getToMs(true);
102
102
  const currentRangeKey = timeRangeSelection.getRangeKey();
103
103
  // Commit with refreshed time range
104
+ console.log('[draftExpression] setQueryExpression: committing with refreshed time range:', draftSelection.expression);
104
105
  commitDraft({
105
106
  from: currentFrom,
106
107
  to: currentTo,
@@ -149,7 +150,7 @@ const ProfileSelector = ({ queryClient, closeProfile, enforcedProfileName, compa
149
150
  queryExpressionString === '{}';
150
151
  const queryBrowserRef = useRef(null);
151
152
  const sumByRef = useRef(null);
152
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 flex", children: [_jsx(LabelsQueryProvider, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName ?? profileType.toString(), queryClient: queryClient, start: timeRangeSelection.getFromMs(), end: timeRangeSelection.getToMs(), suffix: suffix, children: _jsx(LabelsSource, { children: _jsx(QueryControls, { showProfileTypeSelector: showProfileTypeSelector, showSumBySelector: showSumBySelector, profileTypesData: profileTypesData, profileTypesLoading: profileTypesLoading, selectedProfileName: selectedProfileName, setProfileName: setProfileName, setMatchersString: setMatchersString, setQueryExpression: setQueryExpression, query: query, queryBrowserRef: queryBrowserRef, timeRangeSelection: timeRangeSelection, setTimeRangeSelection: handleTimeRangeChange, searchDisabled: searchDisabled, setQueryBrowserMode: setQueryBrowserMode, advancedModeForQueryBrowser: advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser: setAdvancedModeForQueryBrowser, queryClient: queryClient, sumByRef: sumByRef, labels: labels, sumBySelection: draftSelection.sumBy ?? [], sumBySelectionLoading: sumByLoading, setUserSumBySelection: setDraftSumBy, profileType: profileType, profileTypesError: error, viewComponent: viewComponent }) }) }), comparing && (_jsx("div", { children: _jsx(IconButton, { onClick: () => closeProfile(), icon: _jsx(CloseIcon, {}), ...testId(TEST_IDS.COMPARE_CLOSE_BUTTON) }) }))] }), _jsx(MetricsGraphSection, { showMetricsGraph: showMetricsGraph, setDisplayHideMetricsGraphButton: setDisplayHideMetricsGraphButton, heightStyle: heightStyle, querySelection: querySelection, profileSelection: profileSelection, comparing: comparing, sumBy: querySelection.sumBy ?? [], defaultSumByLoading: sumByLoading, queryClient: queryClient, queryExpressionString: queryExpressionString, setTimeRangeSelection: handleTimeRangeChange, selectQuery: commitDraft, setProfileSelection: setProfileSelection, query: query, setQueryExpression: setQueryExpression, setNewQueryExpression: setDraftExpression })] }));
153
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 flex", children: [_jsx(LabelsQueryProvider, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName ?? profileType.toString(), queryClient: queryClient, start: timeRangeSelection.getFromMs(), end: timeRangeSelection.getToMs(), suffix: suffix, children: _jsx(LabelsSource, { children: _jsx(QueryControls, { showProfileTypeSelector: showProfileTypeSelector, showSumBySelector: showSumBySelector, profileTypesData: profileTypesData, profileTypesLoading: profileTypesLoading, selectedProfileName: selectedProfileName, setProfileName: setProfileName, setMatchersString: setMatchersString, setQueryExpression: setQueryExpression, query: query, queryBrowserRef: queryBrowserRef, timeRangeSelection: timeRangeSelection, setTimeRangeSelection: handleTimeRangeChange, searchDisabled: searchDisabled, setQueryBrowserMode: setQueryBrowserMode, advancedModeForQueryBrowser: advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser: setAdvancedModeForQueryBrowser, queryClient: queryClient, sumByRef: sumByRef, labels: labels, sumBySelection: draftSelection.sumBy ?? [], sumBySelectionLoading: sumByLoading, setUserSumBySelection: setDraftSumBy, profileType: profileType, profileTypesError: error, viewComponent: viewComponent, draftSelection: draftSelection, setDraftMatchers: setDraftMatchers, draftParsedQuery: draftParsedQuery }) }) }), comparing && (_jsx("div", { children: _jsx(IconButton, { onClick: () => closeProfile(), icon: _jsx(CloseIcon, {}), ...testId(TEST_IDS.COMPARE_CLOSE_BUTTON) }) }))] }), _jsx(MetricsGraphSection, { showMetricsGraph: showMetricsGraph, setDisplayHideMetricsGraphButton: setDisplayHideMetricsGraphButton, heightStyle: heightStyle, querySelection: querySelection, profileSelection: profileSelection, comparing: comparing, sumBy: querySelection.sumBy ?? [], defaultSumByLoading: sumByLoading, queryClient: queryClient, queryExpressionString: queryExpressionString, setTimeRangeSelection: handleTimeRangeChange, selectQuery: commitDraft, setProfileSelection: setProfileSelection, query: query, setQueryExpression: setQueryExpression, setNewQueryExpression: setDraftExpression })] }));
153
154
  };
154
155
  export default ProfileSelector;
155
156
  const LabelsSource = ({ children }) => {
@@ -3,6 +3,7 @@ import { type SelectInstance } from 'react-select';
3
3
  import { ProfileTypesResponse, QueryServiceClient } from '@parca/client';
4
4
  import { DateTimeRange } from '@parca/components';
5
5
  import { ProfileType, Query } from '@parca/parser';
6
+ import { QuerySelection } from '../ProfileSelector';
6
7
  interface QueryControlsProps {
7
8
  queryClient: QueryServiceClient;
8
9
  query: Query;
@@ -36,7 +37,10 @@ interface QueryControlsProps {
36
37
  sumBySelectionLoading?: boolean;
37
38
  setUserSumBySelection?: (sumBy: string[]) => void;
38
39
  sumByRef?: React.RefObject<SelectInstance>;
40
+ draftSelection: QuerySelection;
41
+ setDraftMatchers: (selection: string) => void;
42
+ draftParsedQuery?: Query | null;
39
43
  }
40
- export declare function QueryControls({ profileType, timeRangeSelection, setTimeRangeSelection, setQueryExpression, searchDisabled, showProfileTypeSelector, showSumBySelector, showAdvancedMode, profileTypesData, profileTypesLoading, selectedProfileName, setProfileName, profileTypesError, viewComponent, setQueryBrowserMode, advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser, queryBrowserRef, labels, sumBySelection, sumBySelectionLoading, setUserSumBySelection, sumByRef, queryClient, }: QueryControlsProps): JSX.Element;
44
+ export declare function QueryControls({ profileType, timeRangeSelection, setTimeRangeSelection, setQueryExpression, searchDisabled, showProfileTypeSelector, showSumBySelector, showAdvancedMode, profileTypesData, profileTypesLoading, selectedProfileName, setProfileName, profileTypesError, viewComponent, setQueryBrowserMode, advancedModeForQueryBrowser, setAdvancedModeForQueryBrowser, queryBrowserRef, labels, sumBySelection, sumBySelectionLoading, setUserSumBySelection, sumByRef, queryClient, draftSelection, setDraftMatchers, draftParsedQuery, }: QueryControlsProps): JSX.Element;
41
45
  export {};
42
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/QueryControls/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,KAAK,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,EAAS,aAAa,EAAuC,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAC,WAAW,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAejD,UAAU,kBAAkB;IAC1B,WAAW,EAAE,kBAAkB,CAAC;IAChC,KAAK,EAAE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AE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gBAAgB,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,EAC5B,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,uBAA+B,EAC/B,iBAAyB,EACzB,gBAAuB,EACvB,gBAAgB,EAChB,mBAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,2BAAmC,EACnC,8BAA8B,EAC9B,eAAe,EACf,MAAW,EACX,cAAmB,EACnB,qBAA6B,EAC7B,qBAAqB,EACrB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAsLlC"}
@@ -21,7 +21,7 @@ import { SelectWithRefresh } from '../SelectWithRefresh';
21
21
  import SimpleMatchers from '../SimpleMatchers/';
22
22
  import ViewMatchers from '../ViewMatchers';
23
23
  import { useLabelNames } from '../hooks/useLabels';
24
- export function QueryControls({ profileType, timeRangeSelection, setTimeRangeSelection, setQueryExpression, searchDisabled, showProfileTypeSelector = false, showSumBySelector = false, showAdvancedMode = true, profileTypesData, profileTypesLoading = false, selectedProfileName, setProfileName, profileTypesError, viewComponent, setQueryBrowserMode, advancedModeForQueryBrowser = false, setAdvancedModeForQueryBrowser, queryBrowserRef, labels = [], sumBySelection = [], sumBySelectionLoading = false, setUserSumBySelection, sumByRef, queryClient, }) {
24
+ export function QueryControls({ profileType, timeRangeSelection, setTimeRangeSelection, setQueryExpression, searchDisabled, showProfileTypeSelector = false, showSumBySelector = false, showAdvancedMode = true, profileTypesData, profileTypesLoading = false, selectedProfileName, setProfileName, profileTypesError, viewComponent, setQueryBrowserMode, advancedModeForQueryBrowser = false, setAdvancedModeForQueryBrowser, queryBrowserRef, labels = [], sumBySelection = [], sumBySelectionLoading = false, setUserSumBySelection, sumByRef, queryClient, draftSelection, setDraftMatchers, draftParsedQuery, }) {
25
25
  const { timezone } = useParcaContext();
26
26
  const defaultQueryBrowserRef = useRef(null);
27
27
  const actualQueryBrowserRef = queryBrowserRef ?? defaultQueryBrowserRef;
@@ -32,7 +32,7 @@ export function QueryControls({ profileType, timeRangeSelection, setTimeRangeSel
32
32
  setQueryBrowserMode?.(advancedModeForQueryBrowser ? 'simple' : 'advanced');
33
33
  }, className: `${advancedModeForQueryBrowser ? 'bg-indigo-600' : 'bg-gray-400 dark:bg-gray-800'} relative inline-flex h-[20px] w-[44px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75`, ...testId(TEST_IDS.ADVANCED_MODE_SWITCH), children: [_jsx("span", { className: "sr-only", children: "Use setting" }), _jsx("span", { "aria-hidden": "true", className: `${advancedModeForQueryBrowser ? 'translate-x-6' : 'translate-x-0'} pointer-events-none inline-block h-[16px] w-[16px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out` })] }), _jsx("label", { className: "text-xs", ...testId(TEST_IDS.QUERY_MODE_LABEL), children: "Advanced Mode" })] }))] }), viewComponent?.createViewComponent] }), viewComponent?.disableExplorativeQuerying === true &&
34
34
  viewComponent?.labelnames !== undefined &&
35
- viewComponent?.labelnames.length >= 1 ? (_jsx(ViewMatchers, { labelNames: viewComponent.labelnames })) : showAdvancedMode && advancedModeForQueryBrowser ? (_jsx(MatchersInput, {})) : (_jsx(SimpleMatchers, { queryBrowserRef: actualQueryBrowserRef, searchExecutedTimestamp: searchExecutedTimestamp }))] }), showSumBySelector && (_jsxs("div", { ...testId(TEST_IDS.SUM_BY_CONTAINER), children: [_jsx("div", { className: "mb-0.5 mt-1.5 flex items-center justify-between", children: _jsx("label", { className: "text-xs", ...testId(TEST_IDS.SUM_BY_LABEL), children: "Sum by" }) }), _jsx(SelectWithRefresh, { id: "h-sum-by-selector", "data-testid": testId(TEST_IDS.SUM_BY_SELECT)['data-testid'], defaultValue: [], isMulti: true, isClearable: false, name: "colors", options: labels.map(label => ({ label, value: label })), className: "parca-select-container text-sm w-full max-w-80", classNamePrefix: "parca-select", value: sumBySelection.map(sumBy => ({ label: sumBy, value: sumBy })), onChange: newValue => {
35
+ viewComponent?.labelnames.length >= 1 ? (_jsx(ViewMatchers, { labelNames: viewComponent.labelnames })) : showAdvancedMode && advancedModeForQueryBrowser ? (_jsx(MatchersInput, {})) : (_jsx(SimpleMatchers, { queryBrowserRef: actualQueryBrowserRef, searchExecutedTimestamp: searchExecutedTimestamp, draftSelection: draftSelection, setDraftMatchers: setDraftMatchers, draftParsedQuery: draftParsedQuery }))] }), showSumBySelector && (_jsxs("div", { ...testId(TEST_IDS.SUM_BY_CONTAINER), children: [_jsx("div", { className: "mb-0.5 mt-1.5 flex items-center justify-between", children: _jsx("label", { className: "text-xs", ...testId(TEST_IDS.SUM_BY_LABEL), children: "Sum by" }) }), _jsx(SelectWithRefresh, { id: "h-sum-by-selector", "data-testid": testId(TEST_IDS.SUM_BY_SELECT)['data-testid'], defaultValue: [], isMulti: true, isClearable: false, name: "colors", options: labels.map(label => ({ label, value: label })), className: "parca-select-container text-sm w-full max-w-80", classNamePrefix: "parca-select", value: sumBySelection.map(sumBy => ({ label: sumBy, value: sumBy })), onChange: newValue => {
36
36
  setUserSumBySelection?.(newValue.map(option => option.value));
37
37
  }, placeholder: "Labels...", styles: {
38
38
  indicatorSeparator: () => ({ display: 'none' }),
@@ -1,9 +1,14 @@
1
+ import { Query } from '@parca/parser';
2
+ import { QuerySelection } from '../ProfileSelector';
1
3
  import { type SelectItem } from './Select';
2
4
  interface Props {
3
5
  queryBrowserRef: React.RefObject<HTMLDivElement>;
4
6
  searchExecutedTimestamp?: number;
7
+ draftSelection: QuerySelection;
8
+ setDraftMatchers: (selection: string) => void;
9
+ draftParsedQuery?: Query | null;
5
10
  }
6
11
  export declare const transformLabelsForSelect: (labelNames: string[]) => SelectItem[];
7
- declare const SimpleMatchers: ({ queryBrowserRef, searchExecutedTimestamp, }: Props) => JSX.Element;
12
+ declare const SimpleMatchers: ({ queryBrowserRef, searchExecutedTimestamp, draftSelection, setDraftMatchers, draftParsedQuery, }: Props) => JSX.Element;
8
13
  export default SimpleMatchers;
9
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/index.tsx"],"names":[],"mappings":"AA0BA,OAAe,EAAC,KAAK,UAAU,EAAC,MAAM,UAAU,CAAC;AAEjD,UAAU,KAAK;IACb,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACjD,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAUD,eAAO,MAAM,wBAAwB,GAAI,YAAY,MAAM,EAAE,KAAG,UAAU,EAQzE,CAAC;AAiDF,QAAA,MAAM,cAAc,GAAI,+CAIrB,KAAK,KAAG,GAAG,CAAC,OAyZd,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAIpC,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAe,EAAC,KAAK,UAAU,EAAC,MAAM,UAAU,CAAC;AAEjD,UAAU,KAAK;IACb,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACjD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gBAAgB,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CACjC;AAUD,eAAO,MAAM,wBAAwB,GAAI,YAAY,MAAM,EAAE,KAAG,UAAU,EAQzE,CAAC;AAiDF,QAAA,MAAM,cAAc,GAAI,mGAMrB,KAAK,KAAG,GAAG,CAAC,OAoZd,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -20,7 +20,6 @@ import { TEST_IDS, testId } from '@parca/test-utils';
20
20
  import { millisToProtoTimestamp, sanitizeLabelValue } from '@parca/utilities';
21
21
  import { useUnifiedLabels } from '../contexts/UnifiedLabelsContext';
22
22
  import { transformLabelName } from '../contexts/utils';
23
- import { useQueryState } from '../hooks/useQueryState';
24
23
  import Select from './Select';
25
24
  export const transformLabelsForSelect = (labelNames) => {
26
25
  return labelNames.map(labelName => ({
@@ -61,7 +60,7 @@ const operatorOptions = [
61
60
  },
62
61
  },
63
62
  ];
64
- const SimpleMatchers = ({ queryBrowserRef, searchExecutedTimestamp, }) => {
63
+ const SimpleMatchers = ({ queryBrowserRef, searchExecutedTimestamp, draftSelection, setDraftMatchers, draftParsedQuery, }) => {
65
64
  const [queryRows, setQueryRows] = useState([
66
65
  { labelName: '', operator: '=', labelValue: '', labelValues: [], isLoading: false },
67
66
  ]);
@@ -70,10 +69,7 @@ const SimpleMatchers = ({ queryBrowserRef, searchExecutedTimestamp, }) => {
70
69
  const { queryServiceClient: parcaQueryClient } = useParcaContext();
71
70
  const [showAll, setShowAll] = useState(false);
72
71
  const [isActivelyEditing, setIsActivelyEditing] = useState(false);
73
- const { labelNameMappingsForSimpleMatchers: labelNameOptions, isLabelNamesLoading: labelNamesLoading, refetchLabelNames, suffix, } = useUnifiedLabels();
74
- const { draftSelection, setDraftMatchers, draftParsedQuery } = useQueryState({
75
- suffix,
76
- });
72
+ const { labelNameMappingsForSimpleMatchers: labelNameOptions, isLabelNamesLoading: labelNamesLoading, refetchLabelNames, } = useUnifiedLabels();
77
73
  // Reset editing mode when search is executed
78
74
  useEffect(() => {
79
75
  if (searchExecutedTimestamp !== undefined && searchExecutedTimestamp > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"useQueryState.d.ts","sourceRoot":"","sources":["../../src/hooks/useQueryState.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAA8B,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAI7F,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,mBAAmB;IAE3B,cAAc,EAAE,cAAc,CAAC;IAG/B,cAAc,EAAE,cAAc,CAAC;IAG/B,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnE,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAG7C,WAAW,EAAE,CAAC,kBAAkB,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IAG9F,gBAAgB,E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AG,SAAS,KAAK,IAAI,CAAC;IACrD,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAG7C,WAAW,EAAE,CAAC,kBAAkB,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAC;IAG9F,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAG1C,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAGpC,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAGhF,YAAY,EAAE,OAAO,CAAC;IAGtB,gBAAgB,EAAE,KAAK,GAAG,IAAI,CAAC;IAG/B,WAAW,EAAE,KAAK,GAAG,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,GAAI,UAAS,oBAAyB,KAAG,mBAwWlE,CAAC"}
@@ -228,17 +228,6 @@ export const useQueryState = (options = {}) => {
228
228
  setSelectionParam,
229
229
  resetFlameGraphState,
230
230
  ]);
231
- // Draft setters (update local state only, or commit directly if specified)
232
- const setDraftExpressionCallback = useCallback((newExpression, commit = false) => {
233
- if (commit) {
234
- // Commit with the new expression, which will also update merge params and selection
235
- commitDraft(undefined, newExpression);
236
- }
237
- else {
238
- // Only update draft state
239
- setDraftExpression(newExpression);
240
- }
241
- }, [commitDraft]);
242
231
  const setDraftTimeRange = useCallback((newFrom, newTo, newTimeSelection) => {
243
232
  setDraftFrom(newFrom.toString());
244
233
  setDraftTo(newTo.toString());
@@ -289,7 +278,7 @@ export const useQueryState = (options = {}) => {
289
278
  // Draft state
290
279
  draftSelection,
291
280
  // Draft setters
292
- setDraftExpression: setDraftExpressionCallback,
281
+ setDraftExpression,
293
282
  setDraftTimeRange,
294
283
  setDraftSumBy: setDraftSumByCallback,
295
284
  setDraftProfileName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.19.82",
3
+ "version": "0.19.84",
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": "c75b87f52c7ca89a2511f4a10bdd9e60369a032a"
82
+ "gitHead": "8b05cd5f934b7761096254cc73b46c38e2a0f5e6"
83
83
  }
@@ -132,6 +132,7 @@ const ProfileSelector = ({
132
132
  profileSelection,
133
133
  setProfileSelection,
134
134
  sumByLoading,
135
+ draftParsedQuery,
135
136
  } = useQueryState({suffix});
136
137
 
137
138
  // Use draft state for local state instead of committed state
@@ -208,6 +209,10 @@ const ProfileSelector = ({
208
209
  const currentTo = timeRangeSelection.getToMs(true);
209
210
  const currentRangeKey = timeRangeSelection.getRangeKey();
210
211
  // Commit with refreshed time range
212
+ console.log(
213
+ '[draftExpression] setQueryExpression: committing with refreshed time range:',
214
+ draftSelection.expression
215
+ );
211
216
  commitDraft({
212
217
  from: currentFrom,
213
218
  to: currentTo,
@@ -303,6 +308,9 @@ const ProfileSelector = ({
303
308
  profileType={profileType}
304
309
  profileTypesError={error}
305
310
  viewComponent={viewComponent}
311
+ draftSelection={draftSelection}
312
+ setDraftMatchers={setDraftMatchers}
313
+ draftParsedQuery={draftParsedQuery}
306
314
  />
307
315
  </LabelsSource>
308
316
  </LabelsQueryProvider>
@@ -23,6 +23,7 @@ import {ProfileType, Query} from '@parca/parser';
23
23
  import {TEST_IDS, testId} from '@parca/test-utils';
24
24
 
25
25
  import MatchersInput from '../MatchersInput';
26
+ import {QuerySelection} from '../ProfileSelector';
26
27
  import ProfileTypeSelector from '../ProfileTypeSelector';
27
28
  import {SelectWithRefresh} from '../SelectWithRefresh';
28
29
  import SimpleMatchers from '../SimpleMatchers/';
@@ -67,6 +68,9 @@ interface QueryControlsProps {
67
68
  sumBySelectionLoading?: boolean;
68
69
  setUserSumBySelection?: (sumBy: string[]) => void;
69
70
  sumByRef?: React.RefObject<SelectInstance>;
71
+ draftSelection: QuerySelection;
72
+ setDraftMatchers: (selection: string) => void;
73
+ draftParsedQuery?: Query | null;
70
74
  }
71
75
 
72
76
  export function QueryControls({
@@ -94,6 +98,9 @@ export function QueryControls({
94
98
  setUserSumBySelection,
95
99
  sumByRef,
96
100
  queryClient,
101
+ draftSelection,
102
+ setDraftMatchers,
103
+ draftParsedQuery,
97
104
  }: QueryControlsProps): JSX.Element {
98
105
  const {timezone} = useParcaContext();
99
106
  const defaultQueryBrowserRef = useRef<HTMLDivElement>(null);
@@ -178,6 +185,9 @@ export function QueryControls({
178
185
  <SimpleMatchers
179
186
  queryBrowserRef={actualQueryBrowserRef}
180
187
  searchExecutedTimestamp={searchExecutedTimestamp}
188
+ draftSelection={draftSelection}
189
+ setDraftMatchers={setDraftMatchers}
190
+ draftParsedQuery={draftParsedQuery}
181
191
  />
182
192
  )}
183
193
  </div>
@@ -18,17 +18,21 @@ import {useQueryClient} from '@tanstack/react-query';
18
18
  import cx from 'classnames';
19
19
 
20
20
  import {useGrpcMetadata, useParcaContext} from '@parca/components';
21
+ import {Query} from '@parca/parser';
21
22
  import {TEST_IDS, testId} from '@parca/test-utils';
22
23
  import {millisToProtoTimestamp, sanitizeLabelValue} from '@parca/utilities';
23
24
 
25
+ import {QuerySelection} from '../ProfileSelector';
24
26
  import {useUnifiedLabels} from '../contexts/UnifiedLabelsContext';
25
27
  import {transformLabelName} from '../contexts/utils';
26
- import {useQueryState} from '../hooks/useQueryState';
27
28
  import Select, {type SelectItem} from './Select';
28
29
 
29
30
  interface Props {
30
31
  queryBrowserRef: React.RefObject<HTMLDivElement>;
31
32
  searchExecutedTimestamp?: number;
33
+ draftSelection: QuerySelection;
34
+ setDraftMatchers: (selection: string) => void;
35
+ draftParsedQuery?: Query | null;
32
36
  }
33
37
 
34
38
  interface QueryRow {
@@ -98,8 +102,10 @@ const operatorOptions = [
98
102
 
99
103
  const SimpleMatchers = ({
100
104
  queryBrowserRef,
101
-
102
105
  searchExecutedTimestamp,
106
+ draftSelection,
107
+ setDraftMatchers,
108
+ draftParsedQuery,
103
109
  }: Props): JSX.Element => {
104
110
  const [queryRows, setQueryRows] = useState<QueryRow[]>([
105
111
  {labelName: '', operator: '=', labelValue: '', labelValues: [], isLoading: false},
@@ -115,13 +121,8 @@ const SimpleMatchers = ({
115
121
  labelNameMappingsForSimpleMatchers: labelNameOptions,
116
122
  isLabelNamesLoading: labelNamesLoading,
117
123
  refetchLabelNames,
118
- suffix,
119
124
  } = useUnifiedLabels();
120
125
 
121
- const {draftSelection, setDraftMatchers, draftParsedQuery} = useQueryState({
122
- suffix,
123
- });
124
-
125
126
  // Reset editing mode when search is executed
126
127
  useEffect(() => {
127
128
  if (searchExecutedTimestamp !== undefined && searchExecutedTimestamp > 0) {
@@ -337,20 +337,6 @@ export const useQueryState = (options: UseQueryStateOptions = {}): UseQueryState
337
337
  ]
338
338
  );
339
339
 
340
- // Draft setters (update local state only, or commit directly if specified)
341
- const setDraftExpressionCallback = useCallback(
342
- (newExpression: string, commit = false) => {
343
- if (commit) {
344
- // Commit with the new expression, which will also update merge params and selection
345
- commitDraft(undefined, newExpression);
346
- } else {
347
- // Only update draft state
348
- setDraftExpression(newExpression);
349
- }
350
- },
351
- [commitDraft]
352
- );
353
-
354
340
  const setDraftTimeRange = useCallback(
355
341
  (newFrom: number, newTo: number, newTimeSelection: string) => {
356
342
  setDraftFrom(newFrom.toString());
@@ -420,7 +406,7 @@ export const useQueryState = (options: UseQueryStateOptions = {}): UseQueryState
420
406
  draftSelection,
421
407
 
422
408
  // Draft setters
423
- setDraftExpression: setDraftExpressionCallback,
409
+ setDraftExpression,
424
410
  setDraftTimeRange,
425
411
  setDraftSumBy: setDraftSumByCallback,
426
412
  setDraftProfileName,