Repository navigation
fix: deliver default page view events to page handlers - #55
Merged
Merged
Conversation
ListView, GridView, Column, Row, View and ReorderableListView now share a ScrollableMethods mixin whose scroll_to invokes the renderer's existing scroll_to method (offset, delta, scroll_key, duration, curve) on that control instead of only on the page.
ListView, GridView and Column accept on_refresh plus refresh_color, refresh_bgcolor, refresh_displacement, refresh_trigger_distance and refresh_timeout. Page#dispatch_event invokes end_refresh on the control once a refresh handler returns, also when it raises, so the native spinner stops right after the handler's patches. ScrollableMethods gains a public end_refresh for refreshes that finish later.
ListView, GridView, Column and Row accept on_end_reached and end_reached_threshold. The event carries pixels, max_scroll_extent and viewport_dimension and is mapped to GenericEvent.
ListView, GridView, Column, Row, View and ReorderableListView accept
keyboard_dismiss_behavior ("manual" or "onDrag") so dragging a form
can dismiss the on-screen keyboard. page.keyboard_dismiss_behavior=
reaches the implicit page view.
View accepts on_refresh, the refresh_* options, on_end_reached and end_reached_threshold. An explicit view(route:, on_refresh:) is a registered control, so its refresh is dispatched to the handler and acknowledged with end_refresh on the view like any scrollable.
Page#scroll_to, show_drawer, close_drawer, show_end_drawer and close_end_drawer invoked control 1 (the Page). The Flutter Page listener does not know these methods and answered "Unknown Page method"; the View owns them. Like Flet, scroll_to now targets the root view and the drawer methods the top view, which is the implicit page view when the app has no explicit views. The drawer check follows the same view.
This was referenced Oct 28, 2026
A page-level handler (page.on_refresh = ->(e) {}, set_view_props, the DSL
page(...) props or update(:page, ...)) went into the view props, so the
Proc itself was packed onto the wire and no handler was registered. All
of those entry points meet in assign_split_prop, which now registers a
callable on_* as a page handler and sends only an on_* flag: on the
implicit View for View events, on the Page otherwise. page.on(:x) sets
the View flag for View events too. Events the client fires on the
implicit page View (not a registered control, so they used to be
dropped) dispatch to those handlers, and a refresh is acknowledged with
end_refresh on that View.
AdamMusa
force-pushed
the
fix/default-page-view-events
branch
from
October 28, 2026 15:24
bd4249d to
445d23a
Compare
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.
Bug fix approved by the lead (found during Package A / A4, D-10 investigation). Ruby only; it relies on A4's Dart View refresh path (AdamMusa/ruflet-engine#46), and no engine change is needed.
Depends on #52 (A4
view-refresh, for the Viewon_refresh/on_end_reachedkeywords) and #54 (fix/page-view-methods). This branch is #52 plus a cherry-pick of #54's single commit, plus this fix. Review only the top commit,fix: deliver default page view events to page handlers.Bugs (default page View =
page.addwithout explicit views)@view_props, so the Proc itself was packed onto the wire (WireCodec→"#<Proc:0x…>") and no handler was registered. That applied to every page API:page.on_refresh = ->(e) {}and the otheron_*setters (viamethod_missing)page.set_view_props(on_scroll: …), which is also what the top-level DSLpage(on_scroll: …)uses throughDSL::App#runpage.update(:page, on_scroll: …)page.on(:end_reached) { }registered the handler but never seton_end_reached: true, so the client never sent the event.target= the implicit View id (20). That View is not a registered control, sodispatch_eventsilently dropped the event.end_refreshto that View.Fix (page.rb, about 20 lines of code)
on_*setters,set_view_props, the DSLpage(...)props andupdate(:page, …)all end inassign_split_prop. A callable (ornil)on_*value there now goes throughassign_page_handler:@page_event_handlersand sends onlyon_x: true;on_*inViewControl::KEYWORDS: refresh, scroll, end_reached, confirm_pop, size_change, animation_end) and on the Page otherwise (e.g.on_resize);nilremoves both. Non-callable values keep the old prop behavior.page.on(:x) { }also sets theon_x: trueflag on the implicit View for View events. Page events such asroute_changekeep their behavior: no flag.dispatch_eventsends events that target the implicit View (only when there are no explicit views) to the page handlers.ensureas D-2, invokingend_refreshon the implicit View via fix: route page scroll and drawer methods to the page View #54's:root_viewtarget.Usage
Tests
ruflet_server/test/page_handler_wire_test.rb(6 runs) does a realWireCodec.pack/unpackround trip of every message, for each entry point:page.on_scroll =page.set_view_props(on_scroll:)page(on_scroll:)startup path (DSL::App#page→set_view_props, asrundoes)page.update(:page, on_scroll:)page.on(:scroll) { }Each one is followed by
page.addand a laterpage.update(:page, …). The test checks that no#<Proc/#<Methodstring appears on the wire, that the decoded View hason_scroll: true, and that ascrollfrom the implicit View reaches the handler. Before this commit, 4 of the 5 entry points failed.ruflet_core/test/page_default_view_events_test.rb(10 runs, 41 assertions):page.on(:end_reached)andpage.on(:on_refresh)set the View flags, and the event reaches the handler.page.on(:route_change)andpage.on(:resize)set no flags, and route_change still dispatches.set_view_propsandupdate(:page)register handlers.scrollfrom the implicit View reachespage.on_scroll.refreshruns the handler, its patch goes first, and the last message isend_refreshon the View id.= nilclears the handler.verify_pr.sh "" <this tree>withRUBY_PKGS="ruflet_core ruflet ruflet_server ruflet_rails":Wire-key audit against engine #46: NEW 0.