From 7f58121d69095ebee0ad337fa4002604a66f754d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicole=20Miko=C5=82ajczyk?= Date: Thu, 15 May 2025 21:06:40 +0200 Subject: [PATCH] pl-fe: do not use redux for create list form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicole Mikołajczyk --- packages/pl-fe/src/pages/account-lists/lists.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/pl-fe/src/pages/account-lists/lists.tsx b/packages/pl-fe/src/pages/account-lists/lists.tsx index 81f282f25..ed5462a5b 100644 --- a/packages/pl-fe/src/pages/account-lists/lists.tsx +++ b/packages/pl-fe/src/pages/account-lists/lists.tsx @@ -1,7 +1,6 @@ -import React from 'react'; +import React, { useState } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; -import { changeListEditorTitle } from 'pl-fe/actions/lists'; import List, { ListItem } from 'pl-fe/components/list'; import Button from 'pl-fe/components/ui/button'; import Card from 'pl-fe/components/ui/card'; @@ -12,8 +11,6 @@ import Icon from 'pl-fe/components/ui/icon'; import Input from 'pl-fe/components/ui/input'; import Spinner from 'pl-fe/components/ui/spinner'; import Stack from 'pl-fe/components/ui/stack'; -import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; -import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useCreateList, useLists } from 'pl-fe/queries/accounts/use-lists'; import type { List as ListEntity } from 'pl-api'; @@ -35,15 +32,14 @@ const getOrderedLists = (lists: Array>) => { }; const NewListForm: React.FC = () => { - const dispatch = useAppDispatch(); const intl = useIntl(); - const { title: value, isSubmitting: disabled } = useAppSelector((state) => state.listEditor); + const [value, setValue] = useState(''); - const { mutate: createList } = useCreateList(); + const { mutate: createList, isPending } = useCreateList(); const handleChange = (e: React.ChangeEvent) => { - dispatch(changeListEditorTitle(e.target.value)); + setValue(e.target.value); }; const handleSubmit = (e: React.FormEvent) => { @@ -63,14 +59,14 @@ const NewListForm: React.FC = () => {