-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
onError: (error) => { | ||
console.error(error); | ||
}, | ||
})); |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests 👍
apps/angular/crud/src/app/components/todos/todos.component.html
Outdated
Show resolved
Hide resolved
apps/angular/crud/src/app/components/todos/todos.component.html
Outdated
Show resolved
Hide resolved
apps/angular/crud/src/app/components/todos/todos.component.html
Outdated
Show resolved
Hide resolved
This pull request is stale because it has been open for 15 days with no activity. |
This pull request was closed because it has been inactive for 5 days since being marked as stale. |
This PR includes,