Skip to content

Mobile v4 docs: validation + durable native callbacks - #465

Open
shanerbaner82 wants to merge 1 commit into
mainfrom
docs/v4-validation-and-callbacks
Open

Mobile v4 docs: validation + durable native callbacks#465
shanerbaner82 wants to merge 1 commit into
mainfrom
docs/v4-validation-and-callbacks

Conversation

@shanerbaner82

Copy link
Copy Markdown
Contributor

Summary

Documents the two feature PRs landing in core (NativePHP/mobile-air#301 and #302) for the v4 mobile docs.

New page — the-basics/validation.md (order 158, between Nested Components and Dialogs):

  • validate() / validateOnly() in handlers: failure aborts the handler, keeps state, and the next frame renders with $errors — identical on device and web
  • The repeatable #[Validate] attribute, eager per-sync validation (the native:model modifier is the cadence), rule merging, and the constant-expression limitation for Rule objects
  • rules() / messages() / validationAttributes(), inline rule scoping, wildcard validateOnly
  • FormRequest sharing: container method-injection for rules(), authorize() never called, props-only data scope
  • Error display is explicit-only (Livewire semantics): @error, @nativeError, and input error/supporting attributes — a failed validation never changes an element's appearance on its own
  • Manual bag control and per-component child scoping

Updated — the-basics/events.md:

  • Both #[On] spellings (the native: prefix is applied idempotently)
  • Fluent Pending* outcome callbacks and the new onSuccess() sugar
  • Callback durability: two-tier storage, $this-bound closures surviving a process kill (serialize + rebind), constraints (serializable captures, no eval'd closures, persistent cache store), method-name strings as the most robust form
  • Per-listener validation isolation, cross-linked to the validation page

Verification

Every documented fact was verified against the live core source and its test suites (26 validation tests + 8 durable-callback tests) rather than written from memory. Both pages render 200 on nativephp.test; prose Blade directives are @@-escaped per site convention (the docs pipeline compiles .md through Blade — a bare @error in prose is an unclosed if).

Note for reviewers: the feature PRs are not merged yet — this shouldn't ship before they do. One known naming inconsistency left alone per scope rules: text-input.md documents the error attribute as is-error while this page uses the :error alias (both are accepted by BaseTextInput).

🤖 Generated with Claude Code

New the-basics/validation.md (order 158): validate()/validateOnly()
semantics (abort handler, keep state, render with $errors — identical
on device and web), the repeatable #[Validate] attribute with eager
per-sync validation and rule merging, rules()/messages(), inline rule
scoping, FormRequest sharing (method injection, props-only data scope,
authorize() never called), the explicit-only error-display contract
(@error, @nativeError, input error/supporting attributes), manual bag
control, and per-component child scoping.

the-basics/events.md additions: both #[On] spellings (idempotent
native: prefix), the fluent Pending* outcome callbacks and onSuccess()
sugar, callback durability (two-tier storage; $this-closures survive a
process kill via serialize-and-rebind, with the serializable-captures /
no-eval / persistent-cache constraints; method-name strings as the most
robust form), and per-listener validation isolation, cross-linked to
the new validation page.

Every documented fact verified against the live core source and its
test suites (26 validation + 8 durable-callback tests). Prose Blade
directives are @@-escaped per site convention — docs .md pages compile
through Blade, and an unescaped bare @error in prose is an unclosed if.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shanerbaner82
shanerbaner82 requested a review from simonhamp August 8, 2026 13:36
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.

1 participant