@parca/profile 0.19.142 → 0.19.143

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
  3. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +22 -28
  4. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  5. package/dist/ProfileExplorer/ProfileExplorerCompare.js +72 -73
  6. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  7. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  8. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  9. package/dist/ProfileFlameChart/index.js +20 -24
  10. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  11. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +13 -14
  12. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  13. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +6 -5
  14. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  15. package/dist/ProfileFlameGraph/index.js +8 -7
  16. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  17. package/dist/ProfileMetricsGraph/index.js +6 -8
  18. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  19. package/dist/ProfileSelector/MetricsGraphSection.js +48 -55
  20. package/dist/ProfileSelector/index.d.ts +1 -1
  21. package/dist/ProfileSelector/index.d.ts.map +1 -1
  22. package/dist/ProfileSelector/index.js +216 -210
  23. package/dist/ProfileSelector/useAutoQuerySelector.d.ts +1 -3
  24. package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
  25. package/dist/ProfileSelector/useAutoQuerySelector.js +133 -104
  26. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  27. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +24 -25
  28. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  29. package/dist/ProfileView/components/ColorStackLegend.js +3 -5
  30. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  31. package/dist/ProfileView/components/InvertCallStack/index.js +47 -47
  32. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +1 -2
  33. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  34. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +37 -34
  35. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  36. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +282 -294
  37. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  38. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +7 -8
  39. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  40. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  41. package/dist/ProfileView/components/Toolbars/index.js +1 -1
  42. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  43. package/dist/ProfileView/components/ViewSelector/index.js +53 -75
  44. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  45. package/dist/ProfileView/context/DashboardContext.js +36 -44
  46. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  47. package/dist/ProfileView/hooks/useResetFlameGraphState.js +8 -7
  48. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  49. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +59 -59
  50. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  51. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +37 -22
  52. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  53. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  54. package/dist/ProfileView/hooks/useVisualizationState.js +116 -147
  55. package/dist/ProfileViewWithData.d.ts.map +1 -1
  56. package/dist/ProfileViewWithData.js +35 -45
  57. package/dist/Sandwich/index.d.ts.map +1 -1
  58. package/dist/Sandwich/index.js +6 -5
  59. package/dist/SourceView/index.d.ts.map +1 -1
  60. package/dist/SourceView/index.js +6 -4
  61. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  62. package/dist/SourceView/useSelectedLineRange.js +52 -76
  63. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  64. package/dist/Table/MoreDropdown.js +42 -53
  65. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  66. package/dist/Table/TableContextMenu.js +15 -19
  67. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  68. package/dist/Table/hooks/useTableConfiguration.js +107 -115
  69. package/dist/Table/index.d.ts.map +1 -1
  70. package/dist/Table/index.js +16 -16
  71. package/dist/TopTable/index.d.ts.map +1 -1
  72. package/dist/TopTable/index.js +112 -127
  73. package/dist/hooks/urlParsers.d.ts +18 -0
  74. package/dist/hooks/urlParsers.d.ts.map +1 -0
  75. package/dist/hooks/urlParsers.js +44 -0
  76. package/dist/hooks/useColorBy.d.ts +5 -0
  77. package/dist/hooks/useColorBy.d.ts.map +1 -0
  78. package/dist/hooks/useColorBy.js +63 -0
  79. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  80. package/dist/hooks/useCompareModeMeta.js +94 -138
  81. package/dist/hooks/useDashboardItems.d.ts +5 -0
  82. package/dist/hooks/useDashboardItems.d.ts.map +1 -0
  83. package/dist/hooks/useDashboardItems.js +68 -0
  84. package/dist/hooks/useQueryState.d.ts +4 -4
  85. package/dist/hooks/useQueryState.d.ts.map +1 -1
  86. package/dist/hooks/useQueryState.js +127 -122
  87. package/dist/index.d.ts +3 -2
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +3 -12
  90. package/dist/useSumBy.d.ts +1 -1
  91. package/dist/useSumBy.d.ts.map +1 -1
  92. package/dist/useSumBy.js +2 -2
  93. package/package.json +4 -3
  94. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +11 -13
  95. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +11 -9
  96. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  97. package/src/ProfileFlameChart/index.tsx +21 -28
  98. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +10 -9
  99. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +5 -3
  100. package/src/ProfileFlameGraph/index.tsx +6 -9
  101. package/src/ProfileMetricsGraph/index.tsx +6 -8
  102. package/src/ProfileSelector/MetricsGraphSection.tsx +5 -10
  103. package/src/ProfileSelector/index.tsx +33 -33
  104. package/src/ProfileSelector/useAutoQuerySelector.ts +64 -42
  105. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +10 -6
  106. package/src/ProfileView/components/ColorStackLegend.tsx +2 -4
  107. package/src/ProfileView/components/InvertCallStack/index.tsx +5 -4
  108. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +94 -192
  109. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  110. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +24 -25
  111. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +4 -5
  112. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  113. package/src/ProfileView/components/ViewSelector/index.tsx +9 -16
  114. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  115. package/src/ProfileView/hooks/useResetFlameGraphState.ts +6 -4
  116. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +24 -26
  117. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +16 -8
  118. package/src/ProfileView/hooks/useVisualizationState.ts +61 -69
  119. package/src/ProfileViewWithData.tsx +29 -35
  120. package/src/Sandwich/index.tsx +4 -3
  121. package/src/SourceView/index.tsx +4 -2
  122. package/src/SourceView/useSelectedLineRange.ts +34 -19
  123. package/src/Table/MoreDropdown.tsx +9 -11
  124. package/src/Table/TableContextMenu.tsx +10 -13
  125. package/src/Table/hooks/useTableConfiguration.tsx +3 -4
  126. package/src/Table/index.tsx +12 -21
  127. package/src/TopTable/index.tsx +3 -4
  128. package/src/hooks/urlParsers.ts +38 -0
  129. package/src/hooks/useColorBy.ts +42 -0
  130. package/src/hooks/useCompareModeMeta.ts +61 -91
  131. package/src/hooks/useDashboardItems.ts +46 -0
  132. package/src/hooks/useQueryState.test.tsx +275 -345
  133. package/src/hooks/useQueryState.ts +153 -120
  134. package/src/index.tsx +16 -15
  135. package/src/useSumBy.ts +3 -3
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.143 (2026-04-16)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.19.142](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.141...@parca/profile@0.19.142) (2026-04-13)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAqBxC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAAI,gBAAc,KAAK,KAAG,wBA8F7D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAwBxC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAAI,gBAAc,KAAK,KAAG,wBAyF7D,CAAC"}
@@ -17,11 +17,14 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
17
17
  // See the License for the specific language governing permissions and
18
18
  // limitations under the License.
19
19
 
20
+ import { useQueryState } from 'nuqs';
20
21
  import { QueryRequest_ReportType } from '@parca/client';
21
- import { useParcaContext, useURLState } from '@parca/components';
22
+ import { useParcaContext } from '@parca/components';
22
23
  import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_START_LINE, FIELD_FUNCTION_SYSTEM_NAME, FIELD_INLINED, FIELD_LOCATION_ADDRESS, FIELD_LOCATION_LINE, FIELD_MAPPING_BUILD_ID, FIELD_MAPPING_FILE, FIELD_TIMESTAMP } from '../../ProfileFlameGraph/FlameGraphArrow';
23
24
  import { arrowToString } from '../../ProfileFlameGraph/FlameGraphArrow/utils';
24
25
  import { useProfileViewContext } from '../../ProfileView/context/ProfileViewContext';
26
+ import { stringParam } from '../../hooks/urlParsers';
27
+ import { useDashboardItems } from '../../hooks/useDashboardItems';
25
28
  import { useQuery } from '../../useQuery';
26
29
  export var useGraphTooltipMetaInfo = function useGraphTooltipMetaInfo(_ref) {
27
30
  var _table$getChild, _table$getChild2, _table$getChild$get, _table$getChild3, _table$getChild4, _table$getChild$get2, _table$getChild5, _arrowToString, _table$getChild6, _arrowToString2, _table$getChild7, _table$getChild$get3, _table$getChild8, _table$getChild9;
@@ -70,38 +73,29 @@ export var useGraphTooltipMetaInfo = function useGraphTooltipMetaInfo(_ref) {
70
73
  }).filter(function (value) {
71
74
  return value[1] !== '';
72
75
  });
73
- var _useURLState = useURLState('dashboard_items', {
74
- alwaysReturnArray: true
75
- }),
76
- _useURLState2 = _slicedToArray(_useURLState, 2),
77
- dashboardItems = _useURLState2[0],
78
- setDashboardItems = _useURLState2[1];
79
-
80
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
81
- var _useURLState3 = useURLState('source_buildid'),
82
- _useURLState4 = _slicedToArray(_useURLState3, 2),
83
- unusedBuildId = _useURLState4[0],
84
- setSourceBuildId = _useURLState4[1];
85
-
86
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
- var _useURLState5 = useURLState('source_filename'),
88
- _useURLState6 = _slicedToArray(_useURLState5, 2),
89
- unusedFilename = _useURLState6[0],
90
- setSourceFilename = _useURLState6[1];
91
-
92
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
- var _useURLState7 = useURLState('source_line'),
94
- _useURLState8 = _slicedToArray(_useURLState7, 2),
95
- unusedLine = _useURLState8[0],
96
- setSourceLine = _useURLState8[1];
76
+ var _useDashboardItems = useDashboardItems(),
77
+ dashboardItems = _useDashboardItems.dashboardItems,
78
+ setDashboardItems = _useDashboardItems.setDashboardItems;
79
+ var _useQueryState = useQueryState('source_buildid', stringParam),
80
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
81
+ _unusedBuildId = _useQueryState2[0],
82
+ setSourceBuildId = _useQueryState2[1];
83
+ var _useQueryState3 = useQueryState('source_filename', stringParam),
84
+ _useQueryState4 = _slicedToArray(_useQueryState3, 2),
85
+ _unusedFilename = _useQueryState4[0],
86
+ setSourceFilename = _useQueryState4[1];
87
+ var _useQueryState5 = useQueryState('source_line', stringParam),
88
+ _useQueryState6 = _slicedToArray(_useQueryState5, 2),
89
+ _unusedLine = _useQueryState6[0],
90
+ setSourceLine = _useQueryState6[1];
97
91
  var openFile = function openFile() {
98
92
  setDashboardItems([dashboardItems[0], 'source']);
99
93
  if (mappingBuildID != null) {
100
- setSourceBuildId(mappingBuildID);
94
+ void setSourceBuildId(mappingBuildID);
101
95
  }
102
- setSourceFilename(functionFilename);
96
+ void setSourceFilename(functionFilename);
103
97
  if (lineNumber !== undefined) {
104
- setSourceLine(lineNumber.toString());
98
+ void setSourceLine(lineNumber.toString());
105
99
  }
106
100
  };
107
101
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileExplorerCompare.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/ProfileExplorerCompare.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAOvD,UAAU,2BAA2B;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,QAAA,MAAM,sBAAsB,GAAI,8BAG7B,2BAA2B,KAAG,GAAG,CAAC,OAmHpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"ProfileExplorerCompare.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/ProfileExplorerCompare.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAOvD,UAAU,2BAA2B;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,QAAA,MAAM,sBAAsB,GAAI,8BAG7B,2BAA2B,KAAG,GAAG,CAAC,OAsHpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -25,7 +25,6 @@ import { c as _c } from "react-compiler-runtime";
25
25
  // limitations under the License.
26
26
 
27
27
  import { useCallback, useEffect, useMemo, useState } from 'react';
28
- import { useURLStateBatch } from '@parca/components';
29
28
  import { Query } from '@parca/parser';
30
29
  import { TEST_IDS, testId } from '@parca/test-utils';
31
30
  import { ProfileDiffSource, ProfileViewWithData } from '..';
@@ -34,14 +33,13 @@ import { useCompareModeMeta } from '../hooks/useCompareModeMeta';
34
33
  import { useQueryState } from '../hooks/useQueryState';
35
34
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
35
  var ProfileExplorerCompare = function ProfileExplorerCompare(t0) {
37
- var $ = _c(45);
36
+ var $ = _c(44);
38
37
  var queryClient = t0.queryClient,
39
38
  navigateTo = t0.navigateTo;
40
39
  var _useState = useState(true),
41
40
  _useState2 = _slicedToArray(_useState, 2),
42
41
  showMetricsGraph = _useState2[0],
43
42
  setShowMetricsGraph = _useState2[1];
44
- var batchUpdates = useURLStateBatch();
45
43
  var _useCompareModeMeta = useCompareModeMeta(),
46
44
  closeCompareMode = _useCompareModeMeta.closeCompareMode,
47
45
  isCompareMode = _useCompareModeMeta.isCompareMode,
@@ -86,75 +84,76 @@ var ProfileExplorerCompare = function ProfileExplorerCompare(t0) {
86
84
  var enforcedProfileNameA = t3;
87
85
  var t4;
88
86
  var t5;
89
- if ($[4] !== batchUpdates || $[5] !== commitDraftB || $[6] !== isCompareMode || $[7] !== querySelectionA.expression || $[8] !== querySelectionA.from || $[9] !== querySelectionA.timeSelection || $[10] !== querySelectionA.to || $[11] !== querySelectionB.expression || $[12] !== setDraftExpressionB || $[13] !== setDraftTimeRangeB) {
87
+ if ($[4] !== commitDraftB || $[5] !== isCompareMode || $[6] !== querySelectionA.expression || $[7] !== querySelectionA.from || $[8] !== querySelectionA.timeSelection || $[9] !== querySelectionA.to || $[10] !== querySelectionB.expression || $[11] !== setDraftExpressionB || $[12] !== setDraftTimeRangeB) {
90
88
  t4 = function t4() {
91
89
  if (!isCompareMode) {
92
90
  return;
93
91
  }
94
92
  if (querySelectionB.expression === "" && querySelectionA.expression !== "") {
95
- batchUpdates(function () {
96
- setDraftExpressionB(querySelectionA.expression);
97
- setDraftTimeRangeB(querySelectionA.from, querySelectionA.to, querySelectionA.timeSelection);
98
- commitDraftB();
99
- });
93
+ setDraftExpressionB(querySelectionA.expression);
94
+ setDraftTimeRangeB(querySelectionA.from, querySelectionA.to, querySelectionA.timeSelection);
95
+ commitDraftB({
96
+ from: querySelectionA.from,
97
+ to: querySelectionA.to,
98
+ timeSelection: querySelectionA.timeSelection
99
+ }, querySelectionA.expression);
100
100
  }
101
101
  };
102
- t5 = [isCompareMode, querySelectionA.expression, querySelectionA.from, querySelectionA.to, querySelectionA.timeSelection, querySelectionB.expression, setDraftExpressionB, setDraftTimeRangeB, commitDraftB, batchUpdates];
103
- $[4] = batchUpdates;
104
- $[5] = commitDraftB;
105
- $[6] = isCompareMode;
106
- $[7] = querySelectionA.expression;
107
- $[8] = querySelectionA.from;
108
- $[9] = querySelectionA.timeSelection;
109
- $[10] = querySelectionA.to;
110
- $[11] = querySelectionB.expression;
111
- $[12] = setDraftExpressionB;
112
- $[13] = setDraftTimeRangeB;
113
- $[14] = t4;
114
- $[15] = t5;
102
+ t5 = [isCompareMode, querySelectionA.expression, querySelectionA.from, querySelectionA.to, querySelectionA.timeSelection, querySelectionB.expression, setDraftExpressionB, setDraftTimeRangeB, commitDraftB];
103
+ $[4] = commitDraftB;
104
+ $[5] = isCompareMode;
105
+ $[6] = querySelectionA.expression;
106
+ $[7] = querySelectionA.from;
107
+ $[8] = querySelectionA.timeSelection;
108
+ $[9] = querySelectionA.to;
109
+ $[10] = querySelectionB.expression;
110
+ $[11] = setDraftExpressionB;
111
+ $[12] = setDraftTimeRangeB;
112
+ $[13] = t4;
113
+ $[14] = t5;
115
114
  } else {
116
- t4 = $[14];
117
- t5 = $[15];
115
+ t4 = $[13];
116
+ t5 = $[14];
118
117
  }
119
118
  useEffect(t4, t5);
120
119
  var t6;
121
- if ($[16] !== closeCompareMode) {
120
+ if ($[15] !== closeCompareMode) {
122
121
  t6 = function t6() {
123
122
  closeCompareMode("A");
124
123
  };
125
- $[16] = closeCompareMode;
126
- $[17] = t6;
124
+ $[15] = closeCompareMode;
125
+ $[16] = t6;
127
126
  } else {
128
- t6 = $[17];
127
+ t6 = $[16];
129
128
  }
130
129
  var closeProfileA = t6;
131
130
  var t7;
132
- if ($[18] !== closeCompareMode) {
131
+ if ($[17] !== closeCompareMode) {
133
132
  t7 = function t7() {
134
133
  closeCompareMode("B");
135
134
  };
136
- $[18] = closeCompareMode;
137
- $[19] = t7;
135
+ $[17] = closeCompareMode;
136
+ $[18] = t7;
138
137
  } else {
139
- t7 = $[19];
138
+ t7 = $[18];
140
139
  }
141
140
  var closeProfileB = t7;
142
141
  var t8;
143
- if ($[20] === Symbol["for"]("react.memo_cache_sentinel")) {
142
+ if ($[19] === Symbol["for"]("react.memo_cache_sentinel")) {
144
143
  t8 = testId(TEST_IDS.COMPARE_CONTAINER);
145
- $[20] = t8;
144
+ $[19] = t8;
146
145
  } else {
147
- t8 = $[20];
146
+ t8 = $[19];
148
147
  }
149
148
  var t9;
150
- if ($[21] === Symbol["for"]("react.memo_cache_sentinel")) {
149
+ if ($[20] === Symbol["for"]("react.memo_cache_sentinel")) {
151
150
  t9 = testId(TEST_IDS.COMPARE_SIDE_A);
152
- $[21] = t9;
151
+ $[20] = t9;
153
152
  } else {
154
- t9 = $[21];
153
+ t9 = $[20];
155
154
  }
156
155
  var t10;
157
- if ($[22] !== closeProfileA || $[23] !== navigateTo || $[24] !== queryClient || $[25] !== showMetricsGraph) {
156
+ if ($[21] !== closeProfileA || $[22] !== navigateTo || $[23] !== queryClient || $[24] !== showMetricsGraph) {
158
157
  t10 = /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
159
158
  className: "flex-column flex-1 p-2 shadow-md rounded-md"
160
159
  }, t9), {}, {
@@ -169,23 +168,23 @@ var ProfileExplorerCompare = function ProfileExplorerCompare(t0) {
169
168
  setDisplayHideMetricsGraphButton: setShowMetricsGraph
170
169
  })
171
170
  }));
172
- $[22] = closeProfileA;
173
- $[23] = navigateTo;
174
- $[24] = queryClient;
175
- $[25] = showMetricsGraph;
176
- $[26] = t10;
171
+ $[21] = closeProfileA;
172
+ $[22] = navigateTo;
173
+ $[23] = queryClient;
174
+ $[24] = showMetricsGraph;
175
+ $[25] = t10;
177
176
  } else {
178
- t10 = $[26];
177
+ t10 = $[25];
179
178
  }
180
179
  var t11;
181
- if ($[27] === Symbol["for"]("react.memo_cache_sentinel")) {
180
+ if ($[26] === Symbol["for"]("react.memo_cache_sentinel")) {
182
181
  t11 = testId(TEST_IDS.COMPARE_SIDE_B);
183
- $[27] = t11;
182
+ $[26] = t11;
184
183
  } else {
185
- t11 = $[27];
184
+ t11 = $[26];
186
185
  }
187
186
  var t12;
188
- if ($[28] !== closeProfileB || $[29] !== enforcedProfileNameA || $[30] !== navigateTo || $[31] !== queryClient || $[32] !== showMetricsGraph) {
187
+ if ($[27] !== closeProfileB || $[28] !== enforcedProfileNameA || $[29] !== navigateTo || $[30] !== queryClient || $[31] !== showMetricsGraph) {
189
188
  t12 = /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
190
189
  className: "flex-column flex-1 p-2 shadow-md rounded-md"
191
190
  }, t11), {}, {
@@ -200,29 +199,29 @@ var ProfileExplorerCompare = function ProfileExplorerCompare(t0) {
200
199
  setDisplayHideMetricsGraphButton: setShowMetricsGraph
201
200
  })
202
201
  }));
203
- $[28] = closeProfileB;
204
- $[29] = enforcedProfileNameA;
205
- $[30] = navigateTo;
206
- $[31] = queryClient;
207
- $[32] = showMetricsGraph;
208
- $[33] = t12;
202
+ $[27] = closeProfileB;
203
+ $[28] = enforcedProfileNameA;
204
+ $[29] = navigateTo;
205
+ $[30] = queryClient;
206
+ $[31] = showMetricsGraph;
207
+ $[32] = t12;
209
208
  } else {
210
- t12 = $[33];
209
+ t12 = $[32];
211
210
  }
212
211
  var t13;
213
- if ($[34] !== t10 || $[35] !== t12) {
212
+ if ($[33] !== t10 || $[34] !== t12) {
214
213
  t13 = /*#__PURE__*/_jsxs("div", {
215
214
  className: "flex justify-between gap-2 relative mb-2",
216
215
  children: [t10, t12]
217
216
  });
218
- $[34] = t10;
219
- $[35] = t12;
220
- $[36] = t13;
217
+ $[33] = t10;
218
+ $[34] = t12;
219
+ $[35] = t13;
221
220
  } else {
222
- t13 = $[36];
221
+ t13 = $[35];
223
222
  }
224
223
  var t14;
225
- if ($[37] !== isCompareAbsolute || $[38] !== profileSourceA || $[39] !== profileSourceB || $[40] !== queryClient) {
224
+ if ($[36] !== isCompareAbsolute || $[37] !== profileSourceA || $[38] !== profileSourceB || $[39] !== queryClient) {
226
225
  t14 = /*#__PURE__*/_jsx("div", {
227
226
  className: "grid grid-cols-1",
228
227
  children: profileSourceA != null && profileSourceB != null ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, testId(TEST_IDS.COMPARE_PROFILE_VIEW)), {}, {
@@ -239,24 +238,24 @@ var ProfileExplorerCompare = function ProfileExplorerCompare(t0) {
239
238
  })
240
239
  })
241
240
  });
242
- $[37] = isCompareAbsolute;
243
- $[38] = profileSourceA;
244
- $[39] = profileSourceB;
245
- $[40] = queryClient;
246
- $[41] = t14;
241
+ $[36] = isCompareAbsolute;
242
+ $[37] = profileSourceA;
243
+ $[38] = profileSourceB;
244
+ $[39] = queryClient;
245
+ $[40] = t14;
247
246
  } else {
248
- t14 = $[41];
247
+ t14 = $[40];
249
248
  }
250
249
  var t15;
251
- if ($[42] !== t13 || $[43] !== t14) {
250
+ if ($[41] !== t13 || $[42] !== t14) {
252
251
  t15 = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, t8), {}, {
253
252
  children: [t13, t14]
254
253
  }));
255
- $[42] = t13;
256
- $[43] = t14;
257
- $[44] = t15;
254
+ $[41] = t13;
255
+ $[42] = t14;
256
+ $[43] = t15;
258
257
  } else {
259
- t15 = $[44];
258
+ t15 = $[43];
260
259
  }
261
260
  return t15;
262
261
  };
@@ -6,10 +6,10 @@ interface Props {
6
6
  loading?: boolean;
7
7
  cpus: LabelSet[];
8
8
  data: DataPoint[][];
9
- selectedTimeframe?: {
9
+ selectedTimeframe: {
10
10
  labels: LabelSet;
11
11
  bounds: NumberDuo;
12
- };
12
+ } | null;
13
13
  onSelectedTimeframe: (labels: LabelSet, bounds: NumberDuo | undefined) => void;
14
14
  width?: number;
15
15
  bounds: NumberDuo;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameChart/SamplesStrips/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAIvC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAe,MAAM,gBAAgB,CAAC;AAGvD,YAAY,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAQ9C,UAAU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B;AAmID,eAAO,MAAM,YAAY,GAAI,yFAS1B,KAAK,KAAG,GAAG,CAAC,OAyKd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileFlameChart/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAoC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAQpF,OAAO,EAAwB,WAAW,EAAQ,MAAM,eAAe,CAAC;AAKxE,OAAO,EAAsB,aAAa,EAAa,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAC;AA4CpE,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC;AA+BD,eAAO,MAAM,iBAAiB,GAAI,kKAY/B,sBAAsB,KAAG,GAAG,CAAC,OAqM/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileFlameChart/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAoC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEpF,OAAO,EAAwB,WAAW,EAAQ,MAAM,eAAe,CAAC;AAKxE,OAAO,EAAsB,aAAa,EAAa,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAC;AAuCpE,UAAU,sBAAsB;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC;AA+BD,eAAO,MAAM,iBAAiB,GAAI,kKAY/B,sBAAsB,KAAG,GAAG,CAAC,OAuM/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -29,22 +29,21 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
29
  // limitations under the License.
30
30
 
31
31
  import { useEffect, useMemo, useRef } from 'react';
32
+ import { createParser, useQueryState } from 'nuqs';
32
33
  import { QueryRequest_ReportType } from '@parca/client';
33
- import { Button, useParcaContext, useURLState, useURLStateCustom } from '@parca/components';
34
+ import { Button, useParcaContext } from '@parca/components';
34
35
  import { Matcher, MatcherTypes, Query } from '@parca/parser';
35
36
  import { TimeUnits, formatDate, formatDuration } from '@parca/utilities';
36
37
  import ProfileFlameGraph, { validateFlameChartQuery } from '../ProfileFlameGraph';
37
38
  import { boundsFromProfileSource } from '../ProfileFlameGraph/FlameGraphArrow/utils';
38
39
  import { MergedProfileSource, timeFormat } from '../ProfileSource';
39
40
  import { useProfileFilters } from '../ProfileView/components/ProfileFilters/useProfileFilters';
41
+ import { flamechartDimensionParser } from '../hooks/urlParsers';
40
42
  import { useQuery } from '../useQuery';
41
43
  import { SamplesStrip } from './SamplesStrips';
42
44
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
43
- var TimeframeStateSerializer = {
45
+ var timeframeParser = createParser({
44
46
  parse: function parse(value) {
45
- if (value == null || value === '' || value === 'undefined' || Array.isArray(value)) {
46
- return undefined;
47
- }
48
47
  try {
49
48
  var _value$split = value.split('|'),
50
49
  _value$split2 = _slicedToArray(_value$split, 2),
@@ -77,18 +76,17 @@ var TimeframeStateSerializer = {
77
76
  } catch (_unused) {
78
77
  // Ignore parsing errors
79
78
  }
80
- return undefined;
79
+ return null;
81
80
  },
82
- stringify: function stringify(value) {
83
- if (value == null) {
84
- return '';
85
- }
81
+ serialize: function serialize(value) {
86
82
  var labelsStr = value.labels.labels.map(function (l) {
87
83
  return "".concat(l.name, ":").concat(l.value);
88
84
  }).join(',');
89
85
  return "".concat(labelsStr, "|").concat(value.bounds[0], ",").concat(value.bounds[1]);
90
86
  }
91
- };
87
+ }).withOptions({
88
+ history: 'replace'
89
+ });
92
90
  // Helper to create a filtered profile source with narrowed time bounds
93
91
  // and dimension label matchers from the selected strip.
94
92
  var createFilteredProfileSource = function createFilteredProfileSource(profileSource, selectedTimeframe) {
@@ -125,17 +123,15 @@ export var ProfileFlameChart = function ProfileFlameChart(_ref) {
125
123
  var _useProfileFilters = useProfileFilters(),
126
124
  protoFilters = _useProfileFilters.protoFilters;
127
125
  var zoomControlsRef = useRef(null);
128
- var _useURLStateCustom = useURLStateCustom('flamechart_timeframe', TimeframeStateSerializer),
129
- _useURLStateCustom2 = _slicedToArray(_useURLStateCustom, 2),
130
- selectedTimeframe = _useURLStateCustom2[0],
131
- setSelectedTimeframe = _useURLStateCustom2[1];
126
+ var _useQueryState = useQueryState('flamechart_timeframe', timeframeParser),
127
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
128
+ selectedTimeframe = _useQueryState2[0],
129
+ setSelectedTimeframe = _useQueryState2[1];
132
130
 
133
131
  // Read flamechart dimension from URL state to detect changes
134
- var _useURLState = useURLState('flamechart_dimension', {
135
- alwaysReturnArray: true
136
- }),
137
- _useURLState2 = _slicedToArray(_useURLState, 1),
138
- flamechartDimension = _useURLState2[0];
132
+ var _useQueryState3 = useQueryState('flamechart_dimension', flamechartDimensionParser.withDefault([])),
133
+ _useQueryState4 = _slicedToArray(_useQueryState3, 1),
134
+ flamechartDimension = _useQueryState4[0];
139
135
 
140
136
  // Reset selection when the parent time range (profileSource) changes
141
137
  var timeBoundsKey = boundsFromProfileSource(profileSource).join(',');
@@ -143,7 +139,7 @@ export var ProfileFlameChart = function ProfileFlameChart(_ref) {
143
139
  useEffect(function () {
144
140
  if (prevTimeBoundsKey.current !== timeBoundsKey) {
145
141
  prevTimeBoundsKey.current = timeBoundsKey;
146
- setSelectedTimeframe(undefined);
142
+ void setSelectedTimeframe(null);
147
143
  }
148
144
  }, [timeBoundsKey, setSelectedTimeframe]);
149
145
 
@@ -153,16 +149,16 @@ export var ProfileFlameChart = function ProfileFlameChart(_ref) {
153
149
  useEffect(function () {
154
150
  if (prevDimensionKey.current !== dimensionKey) {
155
151
  prevDimensionKey.current = dimensionKey;
156
- setSelectedTimeframe(undefined);
152
+ void setSelectedTimeframe(null);
157
153
  }
158
154
  }, [dimensionKey, setSelectedTimeframe]);
159
155
 
160
156
  // Handle timeframe selection from strips
161
157
  var handleSelectedTimeframe = function handleSelectedTimeframe(labels, bounds) {
162
158
  if (bounds === undefined) {
163
- setSelectedTimeframe(undefined);
159
+ void setSelectedTimeframe(null);
164
160
  } else {
165
- setSelectedTimeframe({
161
+ void setSelectedTimeframe({
166
162
  labels: labels,
167
163
  bounds: bounds
168
164
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAOxC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAQ1C,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,WAAW,GAAI,kIAalB,gBAAgB,KAAG,GAAG,CAAC,OAyOzB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAQxC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAU1C,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,WAAW,GAAI,kIAalB,gBAAgB,KAAG,GAAG,CAAC,OAuOzB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -23,14 +23,17 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
23
23
 
24
24
  import { Icon } from '@iconify/react';
25
25
  import cx from 'classnames';
26
+ import { useQueryState } from 'nuqs';
26
27
  import { Item, Menu, Separator, Submenu } from 'react-contexify';
27
28
  import { Tooltip } from 'react-tooltip';
28
- import { useParcaContext, useURLState } from '@parca/components';
29
+ import { useParcaContext } from '@parca/components';
29
30
  import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
30
31
  import { TEST_IDS } from '@parca/test-utils';
31
32
  import { getLastItem } from '@parca/utilities';
32
33
  import { useGraphTooltip } from '../../GraphTooltipArrow/useGraphTooltip';
33
34
  import { useGraphTooltipMetaInfo } from '../../GraphTooltipArrow/useGraphTooltipMetaInfo';
35
+ import { stringParam } from '../../hooks/urlParsers';
36
+ import { useDashboardItems } from '../../hooks/useDashboardItems';
34
37
  import { hexifyAddress, truncateString } from '../../utils';
35
38
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
39
  var ContextMenu = function ContextMenu(_ref) {
@@ -79,17 +82,13 @@ var ContextMenu = function ContextMenu(_ref) {
79
82
  mappingFile = _useGraphTooltipMetaI.mappingFile,
80
83
  mappingBuildID = _useGraphTooltipMetaI.mappingBuildID,
81
84
  inlined = _useGraphTooltipMetaI.inlined;
82
- var _useURLState = useURLState('dashboard_items', {
83
- alwaysReturnArray: true
84
- }),
85
- _useURLState2 = _slicedToArray(_useURLState, 2),
86
- dashboardItems = _useURLState2[0],
87
- setDashboardItems = _useURLState2[1];
88
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
89
- var _useURLState3 = useURLState('sandwich_function_name'),
90
- _useURLState4 = _slicedToArray(_useURLState3, 2),
91
- sandwichFunctionName = _useURLState4[0],
92
- setSandwichFunctionName = _useURLState4[1];
85
+ var _useDashboardItems = useDashboardItems(),
86
+ dashboardItems = _useDashboardItems.dashboardItems,
87
+ setDashboardItems = _useDashboardItems.setDashboardItems;
88
+ var _useQueryState = useQueryState('sandwich_function_name', stringParam),
89
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
90
+ _sandwichFunctionName = _useQueryState2[0],
91
+ setSandwichFunctionName = _useQueryState2[1];
93
92
  if (contextMenuData === null) {
94
93
  return /*#__PURE__*/_jsx(_Fragment, {});
95
94
  }
@@ -195,11 +194,11 @@ var ContextMenu = function ContextMenu(_ref) {
195
194
  return;
196
195
  }
197
196
  if (dashboardItems.includes('sandwich')) {
198
- setSandwichFunctionName(functionName);
197
+ void setSandwichFunctionName(functionName);
199
198
  hideMenu();
200
199
  return;
201
200
  }
202
- setSandwichFunctionName(functionName);
201
+ void setSandwichFunctionName(functionName);
203
202
  setDashboardItems([].concat(_toConsumableArray(dashboardItems), ['sandwich']));
204
203
  hideMenu();
205
204
  },
@@ -1 +1 @@
1
- {"version":3,"file":"TextWithEllipsis.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx"],"names":[],"mappings":"AAmBA,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AA2CD,iBAAS,gBAAgB,CAAC,EAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAC,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAwBjE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"TextWithEllipsis.d.ts","sourceRoot":"","sources":["../../../src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx"],"names":[],"mappings":"AAqBA,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AA2CD,iBAAS,gBAAgB,CAAC,EAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAC,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAwBjE;AAED,eAAe,gBAAgB,CAAC"}
@@ -20,7 +20,8 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
20
  /* eslint-disable react-hooks/set-state-in-effect */
21
21
 
22
22
  import { useEffect, useRef, useState } from 'react';
23
- import { useURLState } from '@parca/components';
23
+ import { useQueryState } from 'nuqs';
24
+ import { stringParam } from '../../hooks/urlParsers';
24
25
  import { jsx as _jsx } from "react/jsx-runtime";
25
26
  function calculateTruncatedText(text, textElement, maxWidth) {
26
27
  var _textElement$parentEl, _textElement$parentEl3;
@@ -68,10 +69,10 @@ function TextWithEllipsis(_ref) {
68
69
  _useState2 = _slicedToArray(_useState, 2),
69
70
  displayText = _useState2[0],
70
71
  setDisplayText = _useState2[1];
71
- var _useURLState = useURLState('align_function_name'),
72
- _useURLState2 = _slicedToArray(_useURLState, 1),
73
- alignFunctionName = _useURLState2[0];
74
- var showFunctionNameFromLeft = alignFunctionName === 'left' || alignFunctionName === undefined;
72
+ var _useQueryState = useQueryState('align_function_name', stringParam.withDefault('left')),
73
+ _useQueryState2 = _slicedToArray(_useQueryState, 1),
74
+ alignFunctionName = _useQueryState2[0];
75
+ var showFunctionNameFromLeft = alignFunctionName === 'left';
75
76
  useEffect(function () {
76
77
  var textElement = textRef.current;
77
78
  if (textElement === null) return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileFlameGraph/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAM7F,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAO9C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAI1C,OAAO,EAAC,mBAAmB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAMpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAIzD,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,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C;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC1D;AAUD,eAAO,MAAM,uBAAuB,GAClC,eAAe,mBAAmB,KACjC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAKpE,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAqC,sRAqBzD,sBAAsB,KAAG,GAAG,CAAC,OAiT/B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -27,14 +27,16 @@ import { c as _c } from "react-compiler-runtime";
27
27
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
28
28
  import cx from 'classnames';
29
29
  import { AnimatePresence, motion } from 'framer-motion';
30
+ import { useQueryState } from 'nuqs';
30
31
  import { useMeasure } from 'react-use';
31
- import { FlameGraphSkeleton, SandwichFlameGraphSkeleton, useParcaContext, useURLState } from '@parca/components';
32
+ import { FlameGraphSkeleton, SandwichFlameGraphSkeleton, useParcaContext } from '@parca/components';
32
33
  import { TEST_IDS, testId } from '@parca/test-utils';
33
34
  import { capitalizeOnlyFirstLetter, divide } from '@parca/utilities';
34
35
  import DiffLegend from '../ProfileView/components/DiffLegend';
35
36
  import { useProfileViewContext } from '../ProfileView/context/ProfileViewContext';
36
37
  import { useProfileMetadata } from '../ProfileView/hooks/useProfileMetadata';
37
38
  import { useVisualizationState } from '../ProfileView/hooks/useVisualizationState';
39
+ import { boolParam } from '../hooks/urlParsers';
38
40
  import { FlameGraphArrow } from './FlameGraphArrow';
39
41
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
40
42
  var numberFormatter = new Intl.NumberFormat('en-US');
@@ -135,11 +137,10 @@ var ProfileFlameGraph = function ProfileFlameGraphNonMemo(_ref) {
135
137
  // By default, we want delta profiles (CPU) to be relatively compared.
136
138
  // For non-delta profiles, like goroutines or memory, we want the profiles to be compared absolutely.
137
139
  var compareAbsoluteDefault = (profileType === null || profileType === void 0 ? void 0 : profileType.delta) === false ? 'true' : 'false';
138
- var _useURLState = useURLState('compare_absolute'),
139
- _useURLState2 = _slicedToArray(_useURLState, 1),
140
- _useURLState2$ = _useURLState2[0],
141
- compareAbsolute = _useURLState2$ === void 0 ? compareAbsoluteDefault : _useURLState2$;
142
- var isCompareAbsolute = compareAbsolute === 'true';
140
+ var _useQueryState = useQueryState('compare_absolute', boolParam),
141
+ _useQueryState2 = _slicedToArray(_useQueryState, 1),
142
+ compareAbsolute = _useQueryState2[0];
143
+ var isCompareAbsolute = compareAbsolute !== null && compareAbsolute !== void 0 ? compareAbsolute : compareAbsoluteDefault === 'true';
143
144
  var mappingsListCount = useMemo(function () {
144
145
  return mappingsList.filter(function (m) {
145
146
  return m !== '';
@@ -169,7 +170,7 @@ var ProfileFlameGraph = function ProfileFlameGraphNonMemo(_ref) {
169
170
  // If there is only one mapping file, we want to color by filename by default.
170
171
  useEffect(function () {
171
172
  if (mappingsListCount === 1 && colorBy !== 'filename') {
172
- setColorBy('filename');
173
+ void setColorBy('filename');
173
174
  }
174
175
  // eslint-disable-next-line react-hooks/exhaustive-deps
175
176
  }, [mappingsListCount]);