Skip to content
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

solution #2739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

solution #2739

wants to merge 1 commit into from

Conversation

Bezushk0
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on your implementation! 🎉 Your code is well-structured and meets most of the task requirements. There are a few minor improvements you could consider, such as adding error handling for the getUser and getTodos functions to prevent unhandled promise rejections. Additionally, reviewing the default values for onSelectTodo, onQuery, and onSelectOption could help avoid unexpected behavior. Keep up the excellent work and continue refining your skills! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +51 to +53
getTodos()
.then(setTodos)
.finally(() => setIsLoading(false));

Choose a reason for hiding this comment

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

Consider adding error handling for the getTodos promise. Currently, if the promise is rejected, it will not be caught, which could lead to unhandled promise rejections. You can add a .catch() block to handle any errors that might occur during the fetching of todos.

Comment on lines +13 to +14
onQuery = () => {},
onSelectOption = () => {},

Choose a reason for hiding this comment

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

The default values for onQuery and onSelectOption are set to empty functions. This might lead to unexpected behavior if these props are not provided by the parent component. Consider making these props required by removing the default values or ensuring that the parent component always provides these functions.

export const TodoList: React.FC<Props> = ({
todos,
selectedTodo,
onSelectTodo = () => {},

Choose a reason for hiding this comment

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

The default value for onSelectTodo is set to an empty function. This might lead to unexpected behavior if this prop is not provided by the parent component. Consider making this prop required by removing the default value or ensuring that the parent component always provides this function.


export const TodoModal: React.FC<Props> = ({
selectedTodo,
onSelectTodo = () => {},

Choose a reason for hiding this comment

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

The default value for onSelectTodo is set to an empty function. This might lead to unexpected behavior if this prop is not provided by the parent component. Consider making this prop required by removing the default value or ensuring that the parent component always provides this function.

Comment on lines +20 to +22
getUser(selectedTodo.userId)
.then(setUser)
.finally(() => setIsLoading(false));

Choose a reason for hiding this comment

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

Consider adding error handling for the getUser promise. Currently, if the promise is rejected, it will not be caught, which could lead to unhandled promise rejections. You can add a .catch() block to handle any errors that might occur during the fetching of user data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants