-
Notifications
You must be signed in to change notification settings - Fork 0
Fix bugs in create test page #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
| } | ||
| return null; | ||
| })} | ||
| {fields.length < 4 ? ( |
There was a problem hiding this comment.
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 = () => { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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[]>([]); |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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) => ( |
There was a problem hiding this comment.
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 } }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memoize this renderProps
fix bugs in create test page