From 602eaf1ec151652cd89fe7c7d871066754fc6467 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Tue, 30 May 2023 09:02:03 -0400 Subject: [PATCH] Use AppDispatch --- app/soapbox/actions/account-notes.ts | 4 ++-- app/soapbox/components/attachment-thumbs.tsx | 4 ++-- app/soapbox/features/compose/components/reply-mentions.tsx | 5 ++--- .../features/crypto-donate/components/crypto-address.tsx | 4 ++-- .../features/status/components/status-interaction-bar.tsx | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/soapbox/actions/account-notes.ts b/app/soapbox/actions/account-notes.ts index 33391cff4..2d0c0cb13 100644 --- a/app/soapbox/actions/account-notes.ts +++ b/app/soapbox/actions/account-notes.ts @@ -4,7 +4,7 @@ import { openModal, closeModal } from './modals'; import type { AxiosError } from 'axios'; import type { AnyAction } from 'redux'; -import type { RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'soapbox/store'; import type { Account } from 'soapbox/types/entities'; const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST'; @@ -51,7 +51,7 @@ function submitAccountNoteFail(error: AxiosError) { }; } -const initAccountNoteModal = (account: Account) => (dispatch: React.Dispatch, getState: () => RootState) => { +const initAccountNoteModal = (account: Account) => (dispatch: AppDispatch, getState: () => RootState) => { const comment = getState().relationships.get(account.id)!.note; dispatch({ diff --git a/app/soapbox/components/attachment-thumbs.tsx b/app/soapbox/components/attachment-thumbs.tsx index 3ac1dbf5f..25b4bec00 100644 --- a/app/soapbox/components/attachment-thumbs.tsx +++ b/app/soapbox/components/attachment-thumbs.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; import Bundle from 'soapbox/features/ui/components/bundle'; import { MediaGallery } from 'soapbox/features/ui/util/async-components'; +import { useAppDispatch } from 'soapbox/hooks'; import type { List as ImmutableList } from 'immutable'; import type { Attachment } from 'soapbox/types/entities'; @@ -16,7 +16,7 @@ interface IAttachmentThumbs { const AttachmentThumbs = (props: IAttachmentThumbs) => { const { media, onClick, sensitive } = props; - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const renderLoading = () =>
; const onOpenMedia = (media: ImmutableList, index: number) => dispatch(openModal('MEDIA', { media, index })); diff --git a/app/soapbox/features/compose/components/reply-mentions.tsx b/app/soapbox/features/compose/components/reply-mentions.tsx index 511950c8e..333b76504 100644 --- a/app/soapbox/features/compose/components/reply-mentions.tsx +++ b/app/soapbox/features/compose/components/reply-mentions.tsx @@ -1,9 +1,8 @@ import React, { useCallback } from 'react'; import { FormattedList, FormattedMessage } from 'react-intl'; -import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; -import { useAppSelector, useCompose, useFeatures } from 'soapbox/hooks'; +import { useAppDispatch, useAppSelector, useCompose, useFeatures } from 'soapbox/hooks'; import { statusToMentionsAccountIdsArray } from 'soapbox/reducers/compose'; import { makeGetStatus } from 'soapbox/selectors'; import { isPubkey } from 'soapbox/utils/nostr'; @@ -15,7 +14,7 @@ interface IReplyMentions { } const ReplyMentions: React.FC = ({ composeId }) => { - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const features = useFeatures(); const compose = useCompose(composeId); diff --git a/app/soapbox/features/crypto-donate/components/crypto-address.tsx b/app/soapbox/features/crypto-donate/components/crypto-address.tsx index 65c4819a2..9352ed029 100644 --- a/app/soapbox/features/crypto-donate/components/crypto-address.tsx +++ b/app/soapbox/features/crypto-donate/components/crypto-address.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; import CopyableInput from 'soapbox/components/copyable-input'; import { Text, Icon, Stack, HStack } from 'soapbox/components/ui'; +import { useAppDispatch } from 'soapbox/hooks'; import { getExplorerUrl } from '../utils/block-explorer'; import { getTitle } from '../utils/coin-db'; @@ -19,7 +19,7 @@ export interface ICryptoAddress { const CryptoAddress: React.FC = (props): JSX.Element => { const { address, ticker, note } = props; - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const handleModalClick = (e: React.MouseEvent): void => { dispatch(openModal('CRYPTO_DONATE', props)); diff --git a/app/soapbox/features/status/components/status-interaction-bar.tsx b/app/soapbox/features/status/components/status-interaction-bar.tsx index 0dc6b1c08..bbbf0c115 100644 --- a/app/soapbox/features/status/components/status-interaction-bar.tsx +++ b/app/soapbox/features/status/components/status-interaction-bar.tsx @@ -2,12 +2,11 @@ import clsx from 'clsx'; import { List as ImmutableList } from 'immutable'; import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { openModal } from 'soapbox/actions/modals'; import { HStack, Text, Emoji } from 'soapbox/components/ui'; -import { useAppSelector, useSoapboxConfig, useFeatures } from 'soapbox/hooks'; +import { useAppSelector, useSoapboxConfig, useFeatures, useAppDispatch } from 'soapbox/hooks'; import { reduceEmoji } from 'soapbox/utils/emoji-reacts'; import { shortNumberFormat } from 'soapbox/utils/numbers'; @@ -22,7 +21,7 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. const me = useAppSelector(({ me }) => me); const { allowedEmoji } = useSoapboxConfig(); - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const features = useFeatures(); const { account } = status;