Skip to content

fix(pages): export ActionResult and getValidationErrors() from framework adapters - #789

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
karthickeyan-dev:fix/export-action-result-787
Nov 11, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
karthickeyan-dev:fix/export-action-result-787

Conversation

@karthickeyan-dev

Copy link
Copy Markdown
Contributor

Closes #787

Summary

The pages API reference says action() "Returns an ActionResult", but none of the framework adapters exported that type, and getValidationErrors() was only reachable through the undocumented void/pages-client.

  • Re-export getValidationErrors and type ActionResult from void/pages-client in @void/react, @void/vue, @void/svelte, and @void/solid, next to the existing isVoidActionError / isCallSiteActionError / VoidActionError re-exports.
  • docs/reference/api/pages.md: link each ActionResult mention to the action() helper guide section, which describes its { ok, pageData } | { ok, error } shape, and add a getValidationErrors(body) row to each framework's runtime table.
import { action, getValidationErrors, type ActionResult } from '@void/react';

const result: ActionResult = await action('/settings?archive');
if (!result.ok) {
  const fieldErrors = getValidationErrors(result.error.body);
  toast.error(Object.values(fieldErrors ?? {})[0] ?? result.error.message);
}

Verification

  • vp run check — 33/33 passed
  • Built the React, Vue, and Solid adapters and confirmed both names are in dist (.mjs and .d.mts). Svelte ships its runtime source directly.
  • vp test run packages/{react,svelte,solid} — all passed
  • vp test run packages/vue — 103/104 passed. The one failure (vue-pages-client.test.ts › "renders an optional typed prop during navigation that preserves page state") also times out on main without this change.

🤖 Generated with Claude Code

The API reference says `action()` returns an `ActionResult`, but no
framework adapter exported that type or `getValidationErrors()`. Re-export
both from `@void/react`, `@void/vue`, `@void/svelte`, and `@void/solid`,
and document them in the pages API reference.

Closes voidzero-dev#787

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cpojer
cpojer merged commit 6d6b654 into voidzero-dev:main Nov 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActionResult and getValidationErrors() aren't exported from the framework adapters

2 participants