Reset spoiler expand state when a message is edited

This commit is contained in:
Scott Nonnenberg 2023-09-19 11:59:22 -07:00 committed by GitHub
parent 959b8ef457
commit 01231eb1c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5046,16 +5046,16 @@ export function reducer(
return state;
}
const toIncrement =
data.reactions?.length ||
existingMessage.editHistory?.length !== data.editHistory?.length
? 1
: 0;
const hasNewEdit =
existingMessage.editHistory?.length !== data.editHistory?.length ? 1 : 0;
const toIncrement = data.reactions?.length || hasNewEdit;
const updatedMessage = {
...data,
displayLimit: existingMessage.displayLimit,
isSpoilerExpanded: existingMessage.isSpoilerExpanded,
isSpoilerExpanded: hasNewEdit
? undefined
: existingMessage.isSpoilerExpanded,
};
return {