-
Notifications
You must be signed in to change notification settings - Fork 612
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
fix: improve delete line from cart functionality #1044
base: main
Are you sure you want to change the base?
fix: improve delete line from cart functionality #1044
Conversation
@grzegorzpokorski is attempting to deploy a commit to the Saleor Commerce Team on Vercel. A member of the Team first needs to authorize it. |
bac9426
to
f77768f
Compare
const deleteLineAction = async (lineId: string, checkoutId: string) => { | ||
"use server"; | ||
|
||
await executeGraphQL(CheckoutDeleteLinesDocument, { | ||
variables: { | ||
checkoutId, | ||
lineIds: [lineId], | ||
}, | ||
cache: "no-cache", | ||
}); | ||
|
||
revalidatePath("/cart"); | ||
}; |
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.
There's already a function for that: deleteLineFromCheckout
in src/app/[channel]/(main)/cart/actions.ts
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 decided to move that action closer to the component that uses it. Do you think it is the wrong move?
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.
Or maybe I should move DeleteLineForm
component closer to the /cart/page.tsx
?
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.
Okay, I have introduced changes. Instead of moving components to src/ui/components
, I have refactored existing components and server actions in their original places within the project structure.
39451a6
to
9e7c463
Compare
9e7c463
to
92625e3
Compare
…d move to the components in src/ui directory
92625e3
to
eddfbf9
Compare
Allow to function properly even without JavaScript (Progressive enhancement).