fix(emoji-rain): increase date comparison trigger

The date comparison check was too strict/wrong, increase it to show the emojis created in the last second to account for delays in connection.
This commit is contained in:
germanocaumo 2023-09-26 15:18:40 -03:00 committed by Lucas Fialho Zawacki
parent b2f25decd6
commit cb075137b3

View File

@ -87,7 +87,10 @@ const EmojiRain = ({ reactions }) => {
useEffect(() => {
if (isAnimating) {
reactions.forEach((reaction) => {
if (Date() == reaction.creationDate && (reaction.reaction !== 'none')) {
//if (Date() == reaction.creationDate && (reaction.reaction !== 'none')) {
const currentTime = new Date().getTime();
const secondsSinceCreated = (currentTime - reaction.creationDate.getTime()) / 1000;
if (secondsSinceCreated <= 1 && (reaction.reaction !== 'none')) {
createEmojiRain(reaction.reaction);
}
});