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

got some problem with loader #2629

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

Conversation

GlibVK
Copy link

@GlibVK GlibVK commented Nov 6, 2024

No description provided.

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.


Thank you for your hard work on this Todo app! While you've done a great job overall, there are a few critical issues that need to be addressed before we can approve the pull request:

  1. Typo in Variable Name: The variable fitchedTodos should be corrected to fetchedTodos. This is important for code readability and to avoid potential confusion.

  2. Missing State Update: In the Filter.Completed case, the setFlag(Filter.Completed) is missing. This is crucial to ensure that the application state correctly reflects the current filter.

These issues impact the core functionality of the app, so it's important to address them. Once these are fixed, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 😊

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

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Comment on lines +38 to +39
getTodos()
.then(fitchedTodos => fitchedTodos.filter(t => !t.completed))

Choose a reason for hiding this comment

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

There is a typo in the variable name fitchedTodos. It should be fetchedTodos to maintain consistency and avoid confusion.

Comment on lines +42 to +46
case Filter.Completed:
getTodos()
.then(fetchTodos => fetchTodos.filter(t => t.completed))
.then(setTodos);
break;

Choose a reason for hiding this comment

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

In the Filter.Completed case, the setFlag(Filter.Completed) is missing. This should be added to ensure the state reflects the current filter.

Comment on lines +20 to +23
const handleFilterByValue = (e: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(e.target.value);
setShowButton(true);
filteredByValue(inputValue);

Choose a reason for hiding this comment

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

In handleFilterByValue, the filteredByValue(inputValue) call uses the state inputValue which might not be updated immediately after setInputValue(e.target.value). Consider using e.target.value directly in filteredByValue to ensure the correct value is passed.

Comment on lines +44 to +46
<span
className="icon"
onClick={() => getUserAndTodo(todo.userId)}

Choose a reason for hiding this comment

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

The onClick event handler is placed on the span element inside the button. It would be more appropriate to place the onClick handler directly on the button element to ensure the entire button is clickable, not just the icon.


<a href="mailto:[email protected]">Leanne Graham</a>
</p>
{loader || !user || !todo ? (

Choose a reason for hiding this comment

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

The condition loader || !user || !todo is used to decide whether to show the loader. This is correct, but ensure that the logic aligns with the expected behavior: the loader should display when data is being fetched or if the data is incomplete.

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.

2 participants