diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-10 19:12:22 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:04 -0300 |
commit | 3a3df6222b3bfcd36b21ea917733e6f5b189c94d (patch) | |
tree | 38fc26d9dae8860a492f92be34fc2443ada20871 | |
parent | 100599e7b42ddc7cbd5a0c633123ee2db11d8dba (diff) |
sort: sortContributionsChronologically: fix non-mutating
-rw-r--r-- | src/util/sort.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/sort.js b/src/util/sort.js index 8a096dc1..ea1e024a 100644 --- a/src/util/sort.js +++ b/src/util/sort.js @@ -429,5 +429,10 @@ export function sortContributionsChronologically(data, sortThings, { sortByDate(contribs, {latestFirst}); - return contribs; + // We're not actually operating on the original data array at any point, + // so since this is meant to be a mutating function like any other, splice + // the sorted contribs into the original array. + data.splice(0, data.length, ...contribs); + + return data; } |