Ensured stats for renamed tagged are propagated to new name

This commit is contained in:
Alejandro Celaya 2022-11-19 09:31:48 +01:00
parent dd9ee044eb
commit 1e155af948

View file

@ -116,8 +116,12 @@ export const tagsListReducerCreator = (
tags: rejectTag(tags, tag),
filteredTags: rejectTag(filteredTags, tag),
}));
builder.addCase(tagEdited, ({ tags, filteredTags, ...rest }, { payload }) => ({
builder.addCase(tagEdited, ({ tags, filteredTags, stats, ...rest }, { payload }) => ({
...rest,
stats: {
...stats,
[payload.newName]: stats[payload.oldName],
},
tags: tags.map(renameTag(payload.oldName, payload.newName)).sort(),
filteredTags: filteredTags.map(renameTag(payload.oldName, payload.newName)).sort(),
}));