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

todos with api task implementation #1959

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuliabakun
Copy link

Copy link

@OlegPopovych OlegPopovych left a comment

Choose a reason for hiding this comment

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

Good work!
Don't overload a server-side)

src/App.tsx Outdated
setVisibleTodos(filterTodos(todosFromServer, query, filter));
})
.finally(() => setLoading(false));
}, [filter, query]);

Choose a reason for hiding this comment

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

It is not necessary to request to the server within every new symbol or filter change, in this case.

Copy link

@StasSokolov StasSokolov left a comment

Choose a reason for hiding this comment

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

Almost done, let's improve and optimise your code a bit more🔥

Also let's add debounce for search, now fetch calling after every changing input value
Снимок экрана 2023-10-31 в 11 00 34

query,
}) => {
const handleFilterChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
const newFilterBy = event.target.value as FilterBy;

Choose a reason for hiding this comment

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

it looks like this variable is redundant, using only one time

</tr>
<tr
data-cy="todo"
className=""

Choose a reason for hiding this comment

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

remove className please

Comment on lines 21 to 27
useEffect(() => {
getUser(todoSelected.userId)
.then((givenUser) => {
setTodoUser(givenUser);
})
.finally(() => setTodoLoading(false));
});

Choose a reason for hiding this comment

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

Suggested change
useEffect(() => {
getUser(todoSelected.userId)
.then((givenUser) => {
setTodoUser(givenUser);
})
.finally(() => setTodoLoading(false));
});
useEffect(() => {
getUser(todoSelected.userId)
.then((givenUser) => {
setTodoUser(givenUser);
})
.finally(() => setTodoLoading(false));
}, []);

let's add deps for useEffect because now useEffect will calling every time, please try to open modal and go to the network
look at requests
Снимок экрана 2023-10-31 в 11 08 29

Comment on lines 60 to 66
{todoSelected.completed
? (
<strong className="has-text-success">Done</strong>
)
: (
<strong className="has-text-danger">Planned</strong>
)}

Choose a reason for hiding this comment

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

we can use single strong tag and only change success to danger and children

Copy link

@sintax1s sintax1s 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

Copy link

@StasSokolov StasSokolov left a comment

Choose a reason for hiding this comment

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

Looks good to me, i'm approving it!

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