feat(DynamicElement): add OnTouchStart/End parameter#7898
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReverts async disposal and DynamicElement usage introduced previously, simplifying component lifecycles and event handling in DynamicElement, Select, and ButtonBase, and restoring direct HTML elements and callbacks in Select. Sequence diagram for Select onchange handling after revertsequenceDiagram
actor User
participant Browser
participant SelectComponent as Select~TValue~
User->>Browser: Edit text in input
User->>Browser: Move focus / confirm
Browser->>SelectComponent: onchange event
activate SelectComponent
SelectComponent->>SelectComponent: OnChange(ChangeEventArgs args)
SelectComponent->>SelectComponent: GetRowsByItems()
SelectComponent->>SelectComponent: GetItemWithEnumValue()
SelectComponent->>SelectComponent: GetCurrentSelectItem()
SelectComponent->>SelectComponent: SelectedItemChanged(SelectedItem item)
SelectComponent-->>Browser: Render updated selected text
deactivate SelectComponent
Class diagram for reverted disposal and event handling changesclassDiagram
class BootstrapComponentBase
class SimpleSelectBase~TValue~
class DynamicElement {
}
class ButtonBase {
bool IsAsync
void RegisterEvents()
protected ValueTask DisposeAsync(bool disposing)
}
class Select~TValue~ {
string _defaultVirtualizedItemText
SelectedItem SelectedItem
SelectedItem SelectedRow
void OnParametersSet()
Task OnClickItem(SelectedItem item)
Task SelectedItemChanged(SelectedItem item)
Task OnChange(ChangeEventArgs args)
SelectedItem GetCurrentSelectItem()
}
BootstrapComponentBase <|-- DynamicElement
BootstrapComponentBase <|-- ButtonBase
SimpleSelectBase~TValue~ <|-- Select~TValue~
%% Key reverted aspects represented structurally:
%% - DynamicElement no longer implements IAsyncDisposable
%% - Select~TValue~ no longer defines a _onChangeEventCallback field
%% - Select~TValue~ no longer overrides DisposeAsync(bool disposing)
%% - ButtonBase.DisposeAsync no longer clears click callbacks but still handles async button unregistering
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7898 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 764 764
Lines 34213 34196 -17
Branches 4706 4707 +1
=========================================
- Hits 34213 34196 -17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR reverts a prior change that introduced async disposal patterns (IDisposeAsync/IAsyncDisposable-style cleanup) into UI components, restoring simpler component lifecycles and event wiring—primarily around DynamicElement, and related usage in Select and Button.
Changes:
- Remove
IAsyncDisposableimplementation and disposal-time delegate clearing fromDynamicElement. - Simplify
Selectrendering/event wiring by removing the cachedEventCallbackfield, using direct@onchange="OnChange", and replacingDynamicElementrow rendering with a plain<div>. - Remove disposal-time clearing of click delegates from
ButtonBase.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/Select/Select.razor.cs | Removes cached EventCallback and manual StateHasChanged call; deletes DisposeAsync override used only for callback clearing. |
| src/BootstrapBlazor/Components/Select/Select.razor | Switches editable input to direct @onchange="OnChange" and replaces DynamicElement row wrapper with a standard <div @onclick=...>. |
| src/BootstrapBlazor/Components/Button/ButtonBase.cs | Removes disposal-time nulling/emptying of click delegates. |
| src/BootstrapBlazor/Components/BaseComponents/DynamicElement.cs | Reverts IAsyncDisposable implementation and associated delegate/content clearing disposal code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # src/BootstrapBlazor/Components/BaseComponents/DynamicElement.cs
Link issues
fixes #7897
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Simplify event handling and disposal for dynamic elements, select inputs, and buttons by reverting custom async disposal logic and using standard Blazor primitives.
Enhancements: