Skip to content

completed the task#2195

Open
SerhiyShimko wants to merge 3 commits into
mate-academy:masterfrom
SerhiyShimko:develop
Open

completed the task#2195
SerhiyShimko wants to merge 3 commits into
mate-academy:masterfrom
SerhiyShimko:develop

Conversation

@SerhiyShimko
Copy link
Copy Markdown

Copy link
Copy Markdown

@Denys-Kravchuk9988 Denys-Kravchuk9988 left a comment

Choose a reason for hiding this comment

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

Good job!

A few things to improve:

  1. By clicking on select all caret button all tasks should display loading icon (loading state)
Image Image

Comment thread src/components/Filter.tsx Outdated
className="todoapp__clear-completed"
data-cy="ClearCompletedButton"
disabled={!todosFromServer?.some(todo => todo.completed === true)}
onClick={() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would recommend to shorten here expression onClick={clearCompleted}

Comment thread src/components/TodoList.tsx Outdated
htmlFor={`checkbox-${tempTodo.id}`}
className="todo__status-label"
>
{''}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{''} seems to be waste here

Comment thread src/components/TodoList.tsx Outdated
type="button"
className="todo__remove"
data-cy="TodoDelete"
onClick={() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's better to shorten onClick={() => deleteTodo(todo.id, todo)}

Comment thread src/components/TodoList.tsx Outdated
htmlFor={`checkbox-${todo.id}`}
className="todo__status-label"
>
{''}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

{''} seems to be waste here

Comment thread src/components/Filter.tsx Outdated
filtrationTodos(selectedFilter);
}, [todosFromServer]);

const clearCompleted = useCallback(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's better to add async/await here

const clearCompleted = useCallback(async () => {
  const todosToDelete = todosFromServer
    .filter(todo => todo.completed)
    .map(todo => deleteTodo(todo.id, todo));

  await Promise.all(todosToDelete);
}, [todosFromServer, deleteTodo]);

Copy link
Copy Markdown

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

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

loader is not working properly at the moment

  1. after trying to change the status of several todos in a short period of time, the loader only appears on the last pressed todo.

  2. after pressing the 'toggle all' button, the loader should appear on every todo that will change its status. instead, it appears on every todo

Image Image loader should not appear in the first two items in this situation

@SerhiyShimko SerhiyShimko requested a review from etojeDenys May 11, 2026 12:42
Copy link
Copy Markdown

@Anton-Kuchmasov Anton-Kuchmasov 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 you did!

Check out comments below - they might be helpful

setTodosFormServer(serverTodos);
})
.catch(() => {
setError('Unable to load todos');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Better approach is creating custom type or enum (f.e., ErrorMessage.ts) and re-use it to avoid possible hard-coded mistakes

Comment on lines +133 to +135
setTimeout(() => {
setError('');
}, 3000);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This function can be splitted in the single helper and could be re-used

/>
)}

{todosFromServer && todosFromServer.length > 0 && (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
{todosFromServer && todosFromServer.length > 0 && (
{todosFromServer && !!todosFromServer.length && (

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.

4 participants