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

Answer:5 # feat: implement tanstack query in todos #772

Closed
wants to merge 3 commits into from

Conversation

sefatanam
Copy link

This PR includes,

  • Implemented TanStack Query in todos
  • Added Delete button and global error handling.
  • Implemented global loading indicator through tanstack.
  • Added some tests for component maintainability

@sefatanam sefatanam changed the title Answer 5 # feat: implement tanstack store in todos Answer 5 # feat: implement tanstack query in todos Apr 14, 2024
@sefatanam sefatanam changed the title Answer 5 # feat: implement tanstack query in todos Answer:5 # feat: implement tanstack query in todos Apr 14, 2024
@tomalaforge tomalaforge added answer answer 5 exercice crud application labels Apr 14, 2024
onError: (error) => {
console.error(error);
},
}));
Copy link
Owner

Choose a reason for hiding this comment

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

You prefer to write it this way, than create a new function for each method ?

Copy link
Author

Choose a reason for hiding this comment

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

Previously, I attempted a method wherein I declared an empty variable named updateTodos, subsequently modifying it within a switch case, and ultimately setting the query data. However, I found this approach unsatisfactory, thats why I did this modifications. Could you kindly recommend an alternative method for accomplishing this task?

Copy link
Author

Choose a reason for hiding this comment

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

You prefer to write it this way, than create a new function for each method ?

I understand your idea from your solution. I will need to create a separate mutation function for each action, such as update and delete. This approach should be very straightforward. Thank you

Copy link
Owner

Choose a reason for hiding this comment

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

I need to update my solution, but yes I think I prefer a single function per operation. Easier to maintain

Copy link
Author

@sefatanam sefatanam Apr 22, 2024

Choose a reason for hiding this comment

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

I've made adjustments to the mutation setup in my todo store, simplifying its usage rather than keeping it completely separate. But I appriciate your solution and will follow in future.

type: OperationType.DELETE,
payload: todoId,
});
});
Copy link
Owner

Choose a reason for hiding this comment

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

Nice tests 👍

Copy link

github-actions bot commented May 9, 2024

This pull request is stale because it has been open for 15 days with no activity.

@github-actions github-actions bot added the stale label May 9, 2024
Copy link

This pull request was closed because it has been inactive for 5 days since being marked as stale.

@github-actions github-actions bot closed this May 15, 2024
@tomalaforge tomalaforge removed the stale label May 22, 2024
@sefatanam sefatanam deleted the angular-crud branch June 24, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 exercice crud application answer answer tanstack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants