Skip to content

Test shared() async results against #[On] listeners - #484

Merged
simonhamp merged 1 commit into
mainfrom
async-shared-on-listener-tests
Sep 20, 2026
Merged

simonhamp merged 1 commit into
mainfrom
async-shared-on-listener-tests

Conversation

@simonhamp

Copy link
Copy Markdown
Member

Follow-up to #228. These were written while #228 was open but weren't pushed before it merged.

Testing shared() in the super-native demo app crashed the screen. The demo's #[On] handler took a single $event argument. But #[On] methods get payload keys bound to their parameter names, and the shared() payload has id, result and status keys. There is no event key, so the call failed. The framework was right. The demo and the docs page had the wrong signature.

The existing shared() test didn't catch it because it used an ->on() closure listener, and closures get the whole payload as one object.

This adds two tests that send a shared() result to a real #[On] method, one for a finished task and one for a failed one. The failure payload has no result key, so that test also shows why every parameter needs a default. The Boost docs index now mentions the name binding too.

One thing that changed since #228: #[On] calls now go through ComponentMethodInvoker, so a $event handler fails with a BindingResolutionException instead of the ArgumentCountError we saw on device. I checked that both new tests fail with the bad signature.

No source changes. Full suite passes locally (1165 tests).

🤖 Generated with Claude Code

The existing shared() test used an ->on() closure listener, which gets the
whole payload as one object. #[On] methods bind payload keys to parameter
names instead, so that path had no coverage. A handler written as
syncComplete($event) broke on device because no payload key is called event.

Add two tests that send a shared() result to a real #[On] method, one for a
finished task and one for a failed one. The failure payload has no result
key, which is why every parameter needs a default. Also mention the name
binding in the Boost docs index.

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: 943cc821-b099-4e4a-a0dc-a164774eb179

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 13af62b into main Sep 20, 2026
6 checks passed
@simonhamp
simonhamp deleted the async-shared-on-listener-tests 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