Next.js Discord

Discord Forum

Inspecting RSC/Server Actions in network

Unanswered
Yellow-breasted Bunting posted this in #help-forum
Open in Discord
Yellow-breasted BuntingOP
Hey all, trying to get my head round RSC and wondering how this cart example works:
https://next.medusajs.com/gb/cart

When a quantity is updated the client sends a POST to /gb/cart but there is no response in the POST request. So how does the client rerender with the new numbers? Basically I'd like to be able to observe what is happening in the chrome network inspector.

Payload of POST:
[
    {
        "lineId": "item_01HQQK7GYYMBDG4MJSHTXG83JH",
        "quantity": 2
    }
]


There doesnt appear to be any optimistic updates with react query or the like:

https://github.com/medusajs/nextjs-starter-medusa/blob/main/src/modules/cart/components/item/index.tsx#L12

6 Replies

Plott Hound
if you look at nextjs-starter-medusa/src/modules/cart/actions.ts

specifically revalidateTag("cart")

this will invalidate the cache which causes the fetch to happen again
Yellow-breasted BuntingOP
@Plott Hound shouldnt the fetch appear in the network tab though?
thanks for looking btw d:^)
European sprat
Hello
i'm currently working on a project,i clone it the repo, run npm install but when i run npm dev to start it, the error pop
Plott Hound
i havent used medusa but this looks like a mess, i'd just write it from scratch
maybe open an issue on their github?