Skip to content

Conversation

@nikitakukharchuk
Copy link
Collaborator

fix bugs in create test page

}
return null;
})}
{fields.length < 4 ? (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create constant for this number (4)

const handleNewTopicCancel = () => {
setShowNewTopicInput(false);
setNewTopicName('');
const getTopicTitles = () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like place for useMemo

dispatch(getAllTopics());
}, []);

console.log(topics);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove log

const topic = useAppSelector(selectTopic);
const { t } = useTranslation('Topic');
const topics = useAppSelector((state) => state.topics.topicData);
// const [topics, setTopics] = useState<Topic[]>([]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like unused string

<Autocomplete
value={value}
loading={isLoading}
filterOptions={(options, params) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create memoized callback for this arrow function

render={() => (
<Stack>
<TextField
{...params}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need all params for TextField?

options={topics}
getOptionLabel={(option) => option.title}
renderOption={(props, option) => <li {...props}>{option.title}</li>}
renderInput={(params) => (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can be memoized

name={nameControl}
rules={{ required: true }}
control={control}
render={({ field, fieldState: { error } }) => (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memoize this renderProps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants