[bugfix] fix 'steal this look' form, uncheck entries after processing (#1454)

This commit is contained in:
f0x52
2023-02-07 18:34:54 +01:00
committed by GitHub
parent 4e4da19720
commit 52fbb3e584
4 changed files with 27 additions and 6 deletions

View File

@ -115,12 +115,26 @@ function CopyEmojiForm({ localEmojiCodes, type, emojiList }) {
const form = {
selectedEmoji: useCheckListInput("selectedEmoji", {
entries: emojiList,
uniqueKey: "shortcode"
uniqueKey: "id"
}),
category: useComboBoxInput("category")
};
const [formSubmit, result] = useFormSubmit(form, query.usePatchRemoteEmojisMutation(), { changedOnly: false });
const [formSubmit, result] = useFormSubmit(
form,
query.usePatchRemoteEmojisMutation(),
{
changedOnly: false,
onFinish: ({ data }) => {
if (data != undefined) {
form.selectedEmoji.updateMultiple(
// uncheck all successfully processed emoji
data.map(([id]) => [id, { checked: false }])
);
}
}
}
);
const buttonsInactive = form.selectedEmoji.someSelected
? {}