docs icon indicating copy to clipboard operation
docs copied to clipboard

Missing docs for `Astro.callAction` in `guides/actions`

Open Rados51 opened this issue 5 months ago • 4 comments

📚 Subject area/topic

Actions

📋 Suggested page

https://docs.astro.build/en/guides/actions/

📋 General description or bullet points (if proposing new content)

There are completely missing docs (on this page) for correct calls from server-side Astro component. If we call it from Astro component with actions.getGreeting instead of Astro.callAction(...), the context is non-existing. I was just scratching my head for a few minutes until I found out the correct way.

// ❌ Wrong
await actions.getGreeting({ name: "Bob" });
// ✅ Correct
await Astro.callAction(actions.getGreeting, { name: "Bob" });

🖥️ Reproduction of code samples in StackBlitz

No response

Rados51 avatar Sep 20 '24 20:09 Rados51