@parca/profile 0.19.28 → 0.19.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +2 -2
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +11 -6
- package/package.json +2 -2
- package/src/ProfileView/components/ProfileFilters/useProfileFilters.ts +2 -2
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +13 -6
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.29](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.28...@parca/profile@0.19.29) (2025-07-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.19.28](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.27...@parca/profile@0.19.28) (2025-07-22)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -114,7 +114,7 @@ export const convertToProtoFilters = (profileFilters) => {
|
|
|
114
114
|
};
|
|
115
115
|
export const useProfileFilters = () => {
|
|
116
116
|
const { appliedFilters, setAppliedFilters } = useProfileFiltersUrlState();
|
|
117
|
-
const [localFilters, setLocalFilters] = useState([]);
|
|
117
|
+
const [localFilters, setLocalFilters] = useState(appliedFilters ?? []);
|
|
118
118
|
const lastAppliedFiltersRef = useRef([]);
|
|
119
119
|
const localFiltersRef = useRef(localFilters);
|
|
120
120
|
localFiltersRef.current = localFilters;
|
|
@@ -238,7 +238,7 @@ export const useProfileFilters = () => {
|
|
|
238
238
|
}, [appliedFilters]);
|
|
239
239
|
return {
|
|
240
240
|
localFilters,
|
|
241
|
-
appliedFilters,
|
|
241
|
+
appliedFilters: appliedFilters ?? [],
|
|
242
242
|
protoFilters,
|
|
243
243
|
hasUnsavedChanges,
|
|
244
244
|
onApplyFilters,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProfileFiltersUrlState.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts"],"names":[],"mappings":"AAaA,OAAO,EAAoB,KAAK,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useProfileFiltersUrlState.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts"],"names":[],"mappings":"AAaA,OAAO,EAAoB,KAAK,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAIjF,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAsDvD,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,aAAa,EAuCnE,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO;IAC3C,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,iBAAiB,EAAE,sBAAsB,CAAC,aAAa,EAAE,CAAC,CAAC;CAoB5D,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useURLStateCustom } from '@parca/components';
|
|
14
|
+
import { decodeMultipleEncodings } from '@parca/utilities';
|
|
14
15
|
import { isPresetKey } from './filterPresets';
|
|
15
16
|
// Compact encoding mappings
|
|
16
17
|
const TYPE_MAP = {
|
|
@@ -62,12 +63,14 @@ export const decodeProfileFilters = (encoded) => {
|
|
|
62
63
|
if (encoded === '' || encoded === undefined)
|
|
63
64
|
return [];
|
|
64
65
|
try {
|
|
65
|
-
|
|
66
|
+
// Handle multiple levels of URL encoding
|
|
67
|
+
const decodedString = decodeMultipleEncodings(encoded) ?? encoded;
|
|
68
|
+
return decodedString.split(',').map((filter, index) => {
|
|
66
69
|
const parts = filter.split(':');
|
|
67
70
|
// Handle preset filters (format: p:presetKey:value)
|
|
68
71
|
if (parts[0] === 'p' && parts.length >= 3) {
|
|
69
|
-
const presetKey =
|
|
70
|
-
const value =
|
|
72
|
+
const presetKey = parts[1];
|
|
73
|
+
const value = parts.slice(2).join(':'); // Handle values with colons
|
|
71
74
|
return {
|
|
72
75
|
id: `filter-${Date.now()}-${index}`,
|
|
73
76
|
type: presetKey,
|
|
@@ -76,14 +79,15 @@ export const decodeProfileFilters = (encoded) => {
|
|
|
76
79
|
}
|
|
77
80
|
// Handle regular filters (format: type:field:match:value)
|
|
78
81
|
const [type, field, match, ...valueParts] = parts;
|
|
79
|
-
const value =
|
|
80
|
-
|
|
82
|
+
const value = valueParts.join(':'); // Handle values with colons
|
|
83
|
+
const decodedFilter = {
|
|
81
84
|
id: `filter-${Date.now()}-${index}`,
|
|
82
85
|
type: TYPE_MAP_REVERSE[type],
|
|
83
86
|
field: FIELD_MAP_REVERSE[field],
|
|
84
87
|
matchType: MATCH_MAP_REVERSE[match],
|
|
85
88
|
value,
|
|
86
89
|
};
|
|
90
|
+
return decodedFilter;
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
93
|
catch {
|
|
@@ -99,9 +103,10 @@ export const useProfileFiltersUrlState = () => {
|
|
|
99
103
|
stringify: value => {
|
|
100
104
|
return encodeProfileFilters(value);
|
|
101
105
|
},
|
|
106
|
+
defaultValue: [],
|
|
102
107
|
});
|
|
103
108
|
return {
|
|
104
|
-
appliedFilters,
|
|
109
|
+
appliedFilters: appliedFilters ?? [],
|
|
105
110
|
setAppliedFilters,
|
|
106
111
|
};
|
|
107
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.29",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"access": "public",
|
|
79
79
|
"registry": "https://registry.npmjs.org/"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "3695a715bae0531c5654c99a604fd9f1a66a80aa"
|
|
82
82
|
}
|
|
@@ -145,7 +145,7 @@ export const useProfileFilters = (): {
|
|
|
145
145
|
} => {
|
|
146
146
|
const {appliedFilters, setAppliedFilters} = useProfileFiltersUrlState();
|
|
147
147
|
|
|
148
|
-
const [localFilters, setLocalFilters] = useState<ProfileFilter[]>([]);
|
|
148
|
+
const [localFilters, setLocalFilters] = useState<ProfileFilter[]>(appliedFilters ?? []);
|
|
149
149
|
|
|
150
150
|
const lastAppliedFiltersRef = useRef<ProfileFilter[]>([]);
|
|
151
151
|
|
|
@@ -312,7 +312,7 @@ export const useProfileFilters = (): {
|
|
|
312
312
|
|
|
313
313
|
return {
|
|
314
314
|
localFilters,
|
|
315
|
-
appliedFilters,
|
|
315
|
+
appliedFilters: appliedFilters ?? [],
|
|
316
316
|
protoFilters,
|
|
317
317
|
hasUnsavedChanges,
|
|
318
318
|
onApplyFilters,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
14
|
import {useURLStateCustom, type ParamValueSetterCustom} from '@parca/components';
|
|
15
|
+
import {decodeMultipleEncodings} from '@parca/utilities';
|
|
15
16
|
|
|
16
17
|
import {isPresetKey} from './filterPresets';
|
|
17
18
|
import {type ProfileFilter} from './useProfileFilters';
|
|
@@ -72,13 +73,16 @@ export const decodeProfileFilters = (encoded: string): ProfileFilter[] => {
|
|
|
72
73
|
if (encoded === '' || encoded === undefined) return [];
|
|
73
74
|
|
|
74
75
|
try {
|
|
75
|
-
|
|
76
|
+
// Handle multiple levels of URL encoding
|
|
77
|
+
const decodedString = decodeMultipleEncodings(encoded) ?? encoded;
|
|
78
|
+
|
|
79
|
+
return decodedString.split(',').map((filter, index) => {
|
|
76
80
|
const parts = filter.split(':');
|
|
77
81
|
|
|
78
82
|
// Handle preset filters (format: p:presetKey:value)
|
|
79
83
|
if (parts[0] === 'p' && parts.length >= 3) {
|
|
80
|
-
const presetKey =
|
|
81
|
-
const value =
|
|
84
|
+
const presetKey = parts[1];
|
|
85
|
+
const value = parts.slice(2).join(':'); // Handle values with colons
|
|
82
86
|
|
|
83
87
|
return {
|
|
84
88
|
id: `filter-${Date.now()}-${index}`,
|
|
@@ -89,15 +93,17 @@ export const decodeProfileFilters = (encoded: string): ProfileFilter[] => {
|
|
|
89
93
|
|
|
90
94
|
// Handle regular filters (format: type:field:match:value)
|
|
91
95
|
const [type, field, match, ...valueParts] = parts;
|
|
92
|
-
const value =
|
|
96
|
+
const value = valueParts.join(':'); // Handle values with colons
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
const decodedFilter = {
|
|
95
99
|
id: `filter-${Date.now()}-${index}`,
|
|
96
100
|
type: TYPE_MAP_REVERSE[type] as ProfileFilter['type'],
|
|
97
101
|
field: FIELD_MAP_REVERSE[field] as ProfileFilter['field'],
|
|
98
102
|
matchType: MATCH_MAP_REVERSE[match] as ProfileFilter['matchType'],
|
|
99
103
|
value,
|
|
100
104
|
};
|
|
105
|
+
|
|
106
|
+
return decodedFilter;
|
|
101
107
|
});
|
|
102
108
|
} catch {
|
|
103
109
|
return [];
|
|
@@ -118,11 +124,12 @@ export const useProfileFiltersUrlState = (): {
|
|
|
118
124
|
stringify: value => {
|
|
119
125
|
return encodeProfileFilters(value);
|
|
120
126
|
},
|
|
127
|
+
defaultValue: [],
|
|
121
128
|
}
|
|
122
129
|
);
|
|
123
130
|
|
|
124
131
|
return {
|
|
125
|
-
appliedFilters,
|
|
132
|
+
appliedFilters: appliedFilters ?? [],
|
|
126
133
|
setAppliedFilters,
|
|
127
134
|
};
|
|
128
135
|
};
|