fix: improve delete line from cart functionality#1044
fix: improve delete line from cart functionality#1044grzegorzpokorski wants to merge 1 commit intosaleor:mainfrom
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.
There's already a function for that: deleteLineFromCheckout in src/app/[channel]/(main)/cart/actions.ts
There was a problem hiding this comment.
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.
Or maybe I should move DeleteLineForm component closer to the /cart/page.tsx?
There was a problem hiding this comment.
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).