diff --git a/package.json b/package.json index d9a116060..dd8faa242 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "multiselect-react-dropdown": "^2.0.25", "object-to-formdata": "^4.5.1", "path-browserify": "^1.0.1", - "pl-api": "^0.0.13", + "pl-api": "^0.0.14", "postcss": "^8.4.29", "process": "^0.11.10", "punycode": "^2.1.1", diff --git a/src/features/account-gallery/index.tsx b/src/features/account-gallery/index.tsx index 5aca4a325..30c106a92 100644 --- a/src/features/account-gallery/index.tsx +++ b/src/features/account-gallery/index.tsx @@ -47,11 +47,11 @@ const AccountGallery = () => { const handleScrollToBottom = () => { if (hasMore) { - handleLoadMore(attachments.size > 0 ? attachments.last()!.status.id : null); + handleLoadMore(); } }; - const handleLoadMore = (maxId: string | null) => { + const handleLoadMore = () => { if (account) { dispatch(fetchAccountTimeline(account.id, { only_media: true }, true)); } diff --git a/src/features/account-timeline/index.tsx b/src/features/account-timeline/index.tsx index e3e31a400..309021107 100644 --- a/src/features/account-timeline/index.tsx +++ b/src/features/account-timeline/index.tsx @@ -59,7 +59,7 @@ const AccountTimeline: React.FC = ({ params, withReplies = fal } }, [account?.id, withReplies]); - const handleLoadMore = (maxId: string) => { + const handleLoadMore = () => { if (account) { dispatch(fetchAccountTimeline(account.id, { exclude_replies: !withReplies }, true)); } diff --git a/src/features/hashtag-timeline/index.tsx b/src/features/hashtag-timeline/index.tsx index f414b9298..37ed90fce 100644 --- a/src/features/hashtag-timeline/index.tsx +++ b/src/features/hashtag-timeline/index.tsx @@ -40,14 +40,10 @@ const HashtagTimeline: React.FC = ({ params }) => { useHashtagStream(tagId); - useEffect(() => { - dispatch(fetchHashtagTimeline(tagId)); - dispatch(fetchHashtag(tagId)); - }, [tagId]); - useEffect(() => { dispatch(clearTimeline(`hashtag:${tagId}`)); - dispatch(fetchHashtagTimeline(tagId, {}, true)); + dispatch(fetchHashtag(tagId)); + dispatch(fetchHashtagTimeline(tagId)); }, [tagId]); return ( diff --git a/src/features/status/components/detailed-status.tsx b/src/features/status/components/detailed-status.tsx index 9df29b24c..6857d2490 100644 --- a/src/features/status/components/detailed-status.tsx +++ b/src/features/status/components/detailed-status.tsx @@ -15,13 +15,12 @@ import QuotedStatus from 'soapbox/features/status/containers/quoted-status-conta import StatusInteractionBar from './status-interaction-bar'; -import type { Status as StatusEntity } from 'soapbox/normalizers'; import type { SelectedStatus } from 'soapbox/selectors'; interface IDetailedStatus { status: SelectedStatus; withMedia?: boolean; - onOpenCompareHistoryModal: (status: Pick) => void; + onOpenCompareHistoryModal: (status: Pick) => void; } const DetailedStatus: React.FC = ({ diff --git a/src/features/status/components/thread.tsx b/src/features/status/components/thread.tsx index 4c025b732..4b2f40807 100644 --- a/src/features/status/components/thread.tsx +++ b/src/features/status/components/thread.tsx @@ -81,14 +81,12 @@ interface IThread { itemClassName?: string; } -const Thread = (props: IThread) => { - const { - itemClassName, - status, - useWindowScroll = true, - withMedia = true, - } = props; - +const Thread: React.FC = ({ + itemClassName, + status, + useWindowScroll = true, + withMedia = true, +}) => { const dispatch = useAppDispatch(); const history = useHistory(); const intl = useIntl(); diff --git a/src/features/ui/components/modals/boost-modal.tsx b/src/features/ui/components/modals/boost-modal.tsx index e429a697c..8988e3c1a 100644 --- a/src/features/ui/components/modals/boost-modal.tsx +++ b/src/features/ui/components/modals/boost-modal.tsx @@ -28,7 +28,7 @@ const BoostModal: React.FC = ({ statusId, onRe const handleReblog = () => { onReblog(status); - onClose(); + onClose('BOOST'); }; const buttonText = status.reblogged ? messages.cancel_reblog : messages.reblog; diff --git a/src/features/ui/components/modals/edit-federation-modal.tsx b/src/features/ui/components/modals/edit-federation-modal.tsx index 7d0a0541d..308b44a99 100644 --- a/src/features/ui/components/modals/edit-federation-modal.tsx +++ b/src/features/ui/components/modals/edit-federation-modal.tsx @@ -57,7 +57,7 @@ const EditFederationModal: React.FC = .then(() => toast.success(intl.formatMessage(messages.success, { host }))) .catch(() => {}); - onClose(); + onClose('EDIT_FEDERATION'); }; const { diff --git a/src/features/ui/components/modals/media-modal.tsx b/src/features/ui/components/modals/media-modal.tsx index 721f5faad..0f1778a77 100644 --- a/src/features/ui/components/modals/media-modal.tsx +++ b/src/features/ui/components/modals/media-modal.tsx @@ -63,7 +63,7 @@ const MediaModal: React.FC = (props) => { const intl = useIntl(); const getStatus = useCallback(makeGetStatus(), []); - const status = useAppSelector((state) => getStatus(state, { id: statusId as string })); + const status = useAppSelector((state) => statusId ? getStatus(state, { id: statusId }) : undefined); const [isLoaded, setIsLoaded] = useState(!!status); const [index, setIndex] = useState(null); @@ -185,16 +185,15 @@ const MediaModal: React.FC = (props) => { return null; }); - /** Fetch the status (and context) from the API. */ - const fetchData = () => dispatch(fetchStatusWithContext(status?.id as string, intl)); - // Load data. useEffect(() => { - fetchData().then(() => { - setIsLoaded(true); - }).catch(() => { - setIsLoaded(true); - }); + if (status?.id) { + dispatch(fetchStatusWithContext(status.id, intl)).then(() => { + setIsLoaded(true); + }).catch(() => { + setIsLoaded(true); + }); + } }, [status?.id]); useEffect(() => { @@ -245,7 +244,7 @@ const MediaModal: React.FC = (props) => { onClose()} + onClick={() => onClose('MEDIA')} theme='dark' className='!p-1.5 hover:scale-105 hover:bg-gray-900' iconClassName='h-5 w-5' diff --git a/src/features/ui/components/modals/report-modal/report-modal.tsx b/src/features/ui/components/modals/report-modal/report-modal.tsx index 5f739a275..89d5747d1 100644 --- a/src/features/ui/components/modals/report-modal/report-modal.tsx +++ b/src/features/ui/components/modals/report-modal/report-modal.tsx @@ -126,7 +126,7 @@ const ReportModal = ({ onClose }: BaseModalProps) => { const cancelAction = () => { switch (currentStep) { case Steps.ONE: - onClose(); + onClose('REPORT'); break; case Steps.TWO: setCurrentStep(Steps.ONE); @@ -159,7 +159,7 @@ const ReportModal = ({ onClose }: BaseModalProps) => { break; case Steps.THREE: dispatch(submitReportSuccess()); - onClose(); + onClose('REPORT'); break; default: break; diff --git a/yarn.lock b/yarn.lock index eb08f253b..5aeb626ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8385,10 +8385,10 @@ pkg-types@^1.0.3: mlly "^1.2.0" pathe "^1.1.0" -pl-api@^0.0.13: - version "0.0.13" - resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.13.tgz#e13eb2a47ee4854cc6aa641bbefa6285f7b8d5fd" - integrity sha512-cyxMaK+IPUTQzMhODx9LZ+P/sMfLb6xu44RyZj7baJX/LSJj/YSMPqhV6xLQfjWm65HyPNOIDnz5hD6dA0v8/w== +pl-api@^0.0.14: + version "0.0.14" + resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.14.tgz#71466b336482dc04739150b88b912bffa648d984" + integrity sha512-dRztsnvQDWlz3P3Rtpgi1fbMbt3SUJOwC2Pn+BnoZIc5lV84KbXQ0/LI5kfGFHATJkH3iTPtqSjVBnIxCYtTVw== dependencies: blurhash "^2.0.5" http-link-header "^1.1.3"