-
Notifications
You must be signed in to change notification settings - Fork 75
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
Events v2: implement delete action for action menu, make sure delete works in the form three dot menu #8297
Conversation
…nt form dots menu
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
@@ -27,7 +35,12 @@ function waitUntilEventIsCreated<R>( | |||
} | |||
|
|||
utils.event.delete.setMutationDefaults(({ canonicalMutationFn }) => ({ | |||
retry: true, | |||
retry: (_, error) => { | |||
if (error.data?.httpStatus === 404 || error.data?.httpStatus === 400) { |
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.
This stops the event deletion from retrying if the endpoint returned with 404 (event most likely already removed) or 400 (it can't be deleted)
<DropdownMenu.Item | ||
key={action.type} | ||
onClick={() => { | ||
if (action.type === 'CREATE' || action.type === 'CUSTOM') { |
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.
We could use enum here as agreed
import { ROUTES } from '@client/v2-events/routes' | ||
import { useEvents } from '@client/v2-events/features/events/useEvents/useEvents' | ||
|
||
export function DeleteEvent() { |
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.
Could this be a method instead of component? deleteEvent.mutate({ eventId })
takes options as second parameter, and it navigation could be provided as onSuccess
callback.
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.
Ah, I see. If the abstraction works. We might want to add a comment here the reason for opting for component-pattern.
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.
Since this is now url accessible by anyone, does backend prevent from deleting non-draft items?
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.
It does yea 👍
No description provided.