Skip to content

docs(mobile/4): fix the shared() #[On] listener example - #527

Merged
simonhamp merged 1 commit into
mainfrom
async-tasks-on-listener-fix
Sep 20, 2026
Merged

simonhamp merged 1 commit into
mainfrom
async-tasks-on-listener-fix

Conversation

@simonhamp

Copy link
Copy Markdown
Member

Follow-up to #446.

The shared() example on the Async Tasks page is wrong. It takes a single $event argument and reads $event->result, but #[On] methods get payload keys bound to their parameter names. The shared() payload has id, result and status keys and no event key, so a screen that copies the example breaks as soon as the task finishes. We hit this testing the super-native demo.

This changes the example to bind $result and $status by name, spells out which keys the success and failure payloads carry, and adds a short aside on why every parameter needs a default.

The aside doesn't name the exception on purpose. It was an ArgumentCountError when we found this, and it's a BindingResolutionException on mobile-air main now that #[On] calls go through ComponentMethodInvoker.

The matching test coverage is in NativePHP/mobile-air#484.

🤖 Generated with Claude Code

The example took a single $event argument and read $event->result. #[On]
methods get payload keys bound to their parameter names, and the shared()
payload has no event key, so copying the example breaks the screen as soon
as the task finishes.

Bind result and status by name instead, list what each payload carries, and
explain why every parameter needs a default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b76b4242-9185-47a8-9ca3-7b7a4e7a4bef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@simonhamp
simonhamp merged commit 753c52f into main Sep 20, 2026
4 checks passed
@simonhamp
simonhamp deleted the async-tasks-on-listener-fix branch September 20, 2026 01:47
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