Skip to content

Commit f2e6a99

Browse files
committed
Clippy Lints page - Do not show groups in URL parameters if reset to defaults
1 parent a865d84 commit f2e6a99

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

util/gh-pages/script.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@
156156
Object.entries(versionFilterKeyMap).map(([key, value]) => [value, key])
157157
);
158158

159+
// An internal URL change occurs when we are modifying the URL parameters in a way
160+
// that should not reload parameters from the URL
161+
let internalURLChange = false;
162+
159163
// loadFromURLParameters retrieves filter settings from the URL parameters and assigns them
160164
// to corresponding $scope variables.
161165
function loadFromURLParameters() {
@@ -266,9 +270,7 @@
266270
}, true);
267271

268272
// Watch for changes in the URL path and update the search and lint display
269-
$scope.$watch(function () {
270-
return $location.path();
271-
}, function (newPath) {
273+
$scope.$watch($location.path, function (newPath) {
272274
const searchParameter = newPath.substring(1);
273275
if ($scope.search !== searchParameter) {
274276
$scope.search = searchParameter;
@@ -290,10 +292,11 @@
290292
}
291293
});
292294

293-
$scope.$watch(function () {
294-
return $location.search();
295-
}, function (newParameters) {
296-
loadFromURLParameters();
295+
$scope.$watch($location.search, function (newParameters) {
296+
if (!internalURLChange) {
297+
loadFromURLParameters();
298+
}
299+
internalURLChange = false;
297300
});
298301

299302
$scope.updatePath = function () {
@@ -331,6 +334,8 @@
331334
for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) {
332335
groups[key] = value;
333336
}
337+
internalURLChange = true;
338+
$location.search('groups', null);
334339
};
335340

336341
$scope.selectedValuesCount = function (obj) {

0 commit comments

Comments
 (0)