Repository navigation
Let handlers set properties, and report ones that can't run - #677
Merged
Merged
Conversation
The docs show `@press="$showSheet = true"` and `@dismiss="$showSheet = false"`, but the parser read those as method names and dispatch dropped them without a word. A swiped-away sheet kept visible = true and never opened again. A handler can now be `$prop = <literal>` (true, false, null, a number or a quoted string) or `$prop = !$prop`. Nothing is evaluated. Both go through ComponentState::set(), so #[Locked] and updated hooks apply, and they work in child tag bindings too. A handler that can't run (no such method, an unsupported expression, a property that isn't public, a toggle on a non-bool) now throws InvalidHandlerException under app.debug and is logged otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simonhamp
added a commit
that referenced
this pull request
Nov 14, 2026
Brings in the handler expression fix (#677). Child event bindings now run through runAction() with ActionSource::ParentBinding, so property handlers and the action pipeline both apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
gwleuverink
added a commit
that referenced
this pull request
Nov 17, 2026
Covers mobile PRs #452, #652, #653, #654, #655, #656, #658, #659, #661, #662, #663, #664, #666, #667, #668, #670, #671, #672, #673, #675, #677 and #678, and the commit on main without a PR: e9e2049 (Bifrost build service in the README). Main 1ad5cf5..5bcd753, 23 commits. Ported to core on branch sync/mobile-main-2026-11-16 of NativePHP/core, which this merge needs: #658 "Sign the durable native-callback cache copy with the app key" (src/Support/NativeCallbacks.php), #667 (min-scale on Text), #661 (dragEnd handlers through invokeUiInteraction()), #670 (Element::closesOnNavigation() and its registry lookup, read by core's farewell frame), #675 (#[Memo] child components, captureRoots(), the compiled view checks once per frame, and the view creator in CoreServiceProvider), #452 (Transition::SlideToBottom and the transition argument on navigate(), back() and replace()) and #677 (property handlers and InvalidHandlerException). Memo and InvalidHandlerException move to core. Their old names resolve to core's through the alias shim. Kept on this branch, as main has them: #670's BottomSheet::closesOnNavigation(), #452's transition on TopBarAction, #678's NativeLayout default, and the docblock #670 gave the farewell frame, which now sits on typesClosedInFarewellFrame(). #653 "Authenticate device events posted to /_native/api/events" merged with DispatchEventFromAppController holding both its check and the core marker check from 23300cc. Its new src/Support/NativeEventSignature.php stays in mobile, next to that controller. Removed again in the merge: CallbackRegistry, Element, ElementRegistry, Text, NativeElementCollector, NativeTagPrecompiler, Transition and NativeCallbacks (main changed them, core has them), Memo and InvalidHandlerException (main added them, core has them), and both cacert.pem copies (main changed them, core ships the bundle). #659 is not ported, as core #21 brings the same file. Main's one line in NativeServiceProvider's view creator is in core's CoreServiceProvider now. AGENTS.md keeps this branch's shared copy. The AGENTS.md that #658 added to main is not taken in. Where its text goes waits for the owner. Adapted for the extraction: MemoComponentsTest reads nativeMemoRoots through core's NativeComponent, which declares it private. Needs NativePHP/core branch sync/mobile-main-2026-11-16 (on #20, which is on #18), and #19 as before. Tests, all on PHP 8.4.27, with core at a local merge of sync/mobile-main-2026-11-16 and #19 (323952d): mobile on this merge, 2,571 passed, 4 risky, 4 skipped (2,485 before the merge). PHPStan: the same 3 errors in RunsAndroid as before. Mobile main (5bcd753), 2,507 passed, 4 risky, 4 skipped. Desktop test:php, main (a9986fd) 2,253 passed and refactor/desktop-layout (87a60ce) 2,552 passed, the same as against the core of 2026-11-04.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Bottom Sheet and Modal docs show handlers like
@press="$showSheet = true"and@dismiss="$showSheet = false". They never worked. The callback parser read the whole expression as a method name, no method had that name, anddispatchUiEvent()returned without a word. A sheet swiped away kept itsvisibleproperty true, so every later tap that set it to true changed nothing and the sheet never opened again.What changes
Handlers can now set a property:
The value must be a literal:
true,false,null, a number or a quoted string.$prop = !$propflips a bool. Nothing is evaluated. The parser turns these into two internal callbacks,__assignPropertyand__toggleProperty, which set the property throughComponentState::set(), so#[Locked]is still refused andupdating/updatedhooks run. The same works in a child component's tag binding, like@saved="$open = false".A handler that can't run is now reported instead of dropped. That covers a method the component doesn't have, an expression outside the syntax above (
$a = foo(),$a = !$b), a property that isn't public, and a toggle on something that isn't a bool. Withapp.debugon it throwsInvalidHandlerException, so the error screen names it. Without debug it's logged and nothing runs.What to watch for
emit()used to skip a missing method silently. It reports it now too.Testing
New unit tests cover the parser, including expressions it must refuse. New feature tests cover a press, a sheet dismiss followed by reopening, toggles, strings, numbers and null,
#[Locked], the updated hook, a child tag binding, and each kind of broken handler with debug on and off. The full suite passes with the usual "turns a component dd() into a readable failure" test filtered out, as it stops the run on main too. Pint is clean.Found while building a demo screen where a swiped-away sheet would not reopen.
🤖 Generated with Claude Code