Skip to main content
The query string of the link that started the run, as an object of strings. Opening /actions/coupon_detail?id=42&tab=codes gives ctx.params the value { id: '42', tab: 'codes' }; opening the action without a query string gives {}.

Usage

Describe the params the action expects with a zod schema in params. The server checks the link against it before the handler runs, and ctx.params gets the parsed, typed value:
Share or bookmark /actions/coupon_detail?id=42, put it in an email, a Slack message or your own admin, and the action opens straight on that coupon. Someone who is not logged in sees the login page first and lands on the same link afterwards. A link that does not fit the schema does not start the action: the page shows The link does not fit this action with what is wrong, e.g. page: Expected number, received nan.

Values

Params are untrusted input

Anyone can write a link with any params, and opening it starts the action for whoever clicks it. Treat ctx.params like a value typed into a form:
  • describe it precisely in params, e.g. z.string().uuid() rather than z.string();
  • check that the user may see or change the record it points to;
  • ask with an io call before anything destructive, instead of deleting straight from a link.