Skip to content
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

Missing docs for Astro.callAction in guides/actions #9458

Open
Rados51 opened this issue Sep 20, 2024 · 1 comment
Open

Missing docs for Astro.callAction in guides/actions #9458

Rados51 opened this issue Sep 20, 2024 · 1 comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages.

Comments

@Rados51
Copy link

Rados51 commented Sep 20, 2024

📚 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 Rados51 added the add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. label Sep 20, 2024
@sarah11918
Copy link
Member

Thanks for pointing this out! I know the release notes from where this utility function was introduced are here: https://github.com/withastro/astro/releases/tag/astro%404.13.1

I can see that the API reference docs were added at that time, but an example of calling a function server-side wasn't included in the final stable documentation. I'll ask @bholmesdev to let us know whether there is a reason for not showing this on the main page (discouraging this use?). If so, maybe we can make sure there's at least a convenient link to the two functions since they're not in the Actions section itself, and might be hard to find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages.
Projects
None yet
Development

No branches or pull requests

2 participants