Skip to content

Commit

Permalink
fix(gallery-group): fixes gallery group being removed on group order …
Browse files Browse the repository at this point in the history
…change (#683)
  • Loading branch information
2xAA authored Feb 9, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2c1e06d commit bf581ee
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/application/worker/store/modules/groups.js
Original file line number Diff line number Diff line change
@@ -286,10 +286,21 @@ const mutations = {
REPLACE_GROUPS(state, { groups, writeToSwap }) {
const writeTo = writeToSwap ? swap : state;

writeTo.groups.splice(0);
const oldGroups = writeTo.groups.splice(0);

const groupsLength = groups.length;
let hasWrittenGalleryId = false;
for (let i = 0; i < groupsLength; i += 1) {
writeTo.groups.push(groups[i]);
if (groups[i].name === constants.GALLERY_GROUP_NAME) {
hasWrittenGalleryId = true;
}
}

if (!hasWrittenGalleryId) {
writeTo.groups.push(
oldGroups.find(group => group.name === constants.GALLERY_GROUP_NAME)
);
}
},

0 comments on commit bf581ee

Please sign in to comment.