Repository navigation
refactor(ui): move multiline :on* handlers in examples into named methods - #424
Merged
Merged
Conversation
…hods Part 3 of #141. The Citry UI snippets and quality scenarios passed 41 block-bodied arrow functions inline as `:on*` callbacks, many spanning several lines inside a tag. Each now lives in the example's `js` `methods` block under a name that says what it does, and the tag binds it by name, so the template reads as markup and the logic reads as JavaScript. The methods keep each handler's arguments, side effects, and order, and write data through `this.`. The old arrows returned nothing, and the components ignore what a callback returns. Short single-expression handlers stay inline. No handler's logic changed. Every converted handler is proven by a browser test. 24 new e2e tests cover the handlers that had none, each written against the old code first and then run against the new. Tests that assert a callback's effect cover CAlertDialog, CCommandPalette, CContextMenu, CDataGrid, CDialog, CDisclosure, CDrawer, CImage, CPopover, CScrollArea, CTabs, CTagsInput, and CTooltip. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 25, 2026
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.
Part 3 of #141. The Citry UI snippets and quality scenarios passed 41 block-bodied arrow functions inline as
:on*callbacks, many of them spanning several lines inside a tag. This PR moves each one into the example'sjsmethodsblock, under a name that says what it does, and the tag now binds it by name.What stays the same
this.. The old arrows returned nothing, and the components ignore a callback's return value. No handler's logic changed.=>, stays inline. Issue Clean up remaining Citry UI template formatting #141 only covers handlers whose line ends in a{block.Proof
Every converted handler is driven by an e2e test. For the handlers that had no test of their effect, this PR adds 24 new e2e tests. Each was written against the old code first, then run against the new code.
cdialog/tests/e2e/test_cdialog_open_change_callbacks_e2e.pycdisclosure/.../test_cdisclosure_open_change_callbacks_e2e.pycpopover/.../test_cpopover_open_change_callbacks_e2e.pyctooltip/.../test_ctooltip_open_change_callbacks_e2e.pycimage/.../test_cimage_status_callbacks_e2e.pyctabs/.../test_ctabs_examples_e2e.pyctags_input/.../test_ctags_input_examples_e2e.pyquality/css/.generated/tailwind.cssis not built in that checkout.Each of the three batches had its own independent reviewer and a prose pass. None found a change in behaviour.
Left out on purpose
v-bind="{ onAction: (...) => { ... } }"objects in some CContextMenu, CMenu and CSplitButton snippets. These are not:on*attributes. They could be a small follow-up.api.mdpages (CAlertDialog, CDialog, CPopover, CTabs, CTooltip). They are short page examples, not copies of the snippets.Found along the way
onActionon CCommandPalette and the command also closes the palette, focus ends up onBODY.calert_dialog/snippets/controlled_action.py, pressing Escape during the 500 ms archive window may close the dialog with "Archive cancelled" and still show "Record archived" afterwards.🤖 Generated with Claude Code