From 217bfc57e88fdfb5469a32745d2c8708acefff4f Mon Sep 17 00:00:00 2001 From: danidfra Date: Tue, 10 Dec 2024 23:06:59 -0300 Subject: [PATCH] Remove ImmutableList from "modal-root" --- src/components/modal-root.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/modal-root.tsx b/src/components/modal-root.tsx index c2f077c65..653acfe80 100644 --- a/src/components/modal-root.tsx +++ b/src/components/modal-root.tsx @@ -12,18 +12,18 @@ import { usePrevious } from 'soapbox/hooks/usePrevious.ts'; import type { ModalType } from 'soapbox/features/ui/components/modal-root.tsx'; import type { ReducerRecord as ReducerComposeEvent } from 'soapbox/reducers/compose-event.ts'; -import type { ReducerCompose } from 'soapbox/reducers/compose.ts'; +import type { Compose } from 'soapbox/reducers/compose.ts'; const messages = defineMessages({ confirm: { id: 'confirmations.cancel.confirm', defaultMessage: 'Discard' }, cancelEditing: { id: 'confirmations.cancel_editing.confirm', defaultMessage: 'Cancel editing' }, }); -export const checkComposeContent = (compose?: ReturnType) => { +export const checkComposeContent = (compose: Compose) => { return !!compose && [ compose.editorState && compose.editorState.length > 0, compose.spoiler_text.length > 0, - compose.media_attachments.size > 0, + compose.media_attachments.length > 0, compose.poll !== null, ].some(check => check === true); }; @@ -69,7 +69,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) const handleOnClose = () => { dispatch((_, getState) => { - const compose = getState().compose.get('compose-modal'); + const compose: Compose = getState().compose['compose-modal']; const hasComposeContent = checkComposeContent(compose); const hasEventComposeContent = checkEventComposeContent(getState().compose_event);