pl-fe: handle status expand/collapse correctly

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-06 00:47:26 +02:00
parent e694db418f
commit 953d580ec3

View File

@ -4,7 +4,7 @@ import React, { useState, useRef, useLayoutEffect, useMemo } from 'react';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';
import { toggleStatusSpoilerExpanded } from 'pl-fe/actions/statuses';
import { collapseStatusSpoiler, expandStatusSpoiler } from 'pl-fe/actions/statuses';
import Icon from 'pl-fe/components/icon';
import { Button, Stack, Text } from 'pl-fe/components/ui';
import { useAppDispatch, useSettings } from 'pl-fe/hooks';
@ -92,7 +92,8 @@ const StatusContent: React.FC<IStatusContent> = React.memo(({
e.preventDefault();
e.stopPropagation();
dispatch(toggleStatusSpoilerExpanded(status));
if (expanded) dispatch(collapseStatusSpoiler(status.id));
else dispatch(expandStatusSpoiler(status.id));
};
useLayoutEffect(() => {