Skip to content

Commit

Permalink
deltaNames isn't necessarily coming in sorted least-to-most specific
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Apr 3, 2024
1 parent 5908ce4 commit 1a7d54c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/web/assets/cp/src/js/Craft.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,8 +1205,8 @@ $.extend(Craft, {
grouped.__root__ = [];
}

// we have to reverse the order as need to go from most to least specific names
let reversedDeltaNames = deltaNames.reverse();
// sort delta names from most to least specific
deltaNames = deltaNames.sort((a, b) => b.length - a.length);

for (let name of deltaNames) {
grouped[name] = [];
Expand All @@ -1218,8 +1218,7 @@ $.extend(Craft, {
params = params.map((p) => decodeURIComponent(p));

paramLoop: for (let param of params) {
// loop through the delta names from most -> least specific
for (let name of reversedDeltaNames) {
for (let name of deltaNames) {
const paramName = param.substring(0, name.length + 1);
if ([`${name}=`, `${name}[`].includes(paramName)) {
if (typeof grouped[name] === 'undefined') {
Expand Down

0 comments on commit 1a7d54c

Please sign in to comment.