Skip to content

refactor: remove the dead OnCreated* constructor hooks - #316

Merged
damyanpetev merged 2 commits into
masterfrom
dpetev/ctor-cleanup
Aug 6, 2026
Merged

refactor: remove the dead OnCreated* constructor hooks#316
damyanpetev merged 2 commits into
masterfrom
dpetev/ctor-cleanup

Conversation

@damyanpetev

@damyanpetev damyanpetev commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #286 - instead of documenting all the ctros, removing the redundant ones (most).

Every generated component and event-args type carried a constructor whose only job was to call a partial void OnCreatedIgb<Type>() extensibility hook:

public IgbAccordion() : base()
{
    OnCreatedIgbAccordion();

}

partial void OnCreatedIgbAccordion();

Across src/ there were 143 such constructors and 143 hook declarations, of which exactly two were ever implemented (IgbTabs, IgbChat). For the other 141 types the constructor was a verbatim re-declaration of the implicit default constructor and the hook compiled away to nothing — pure noise in every file, and a misleading "extension point" that no longer reflects how this repo is maintained.

This PR removes the whole pattern.

What changed

Change Files
Removed the constructor and the unimplemented OnCreatedIgb* hook declaration 141
Inlined the hook body into the constructor and dropped the indirection (IgbChat, IgbTabs) 4
Updated the coding-convention bullet that advertised OnCreatedIgbButton() as the canonical hook example .github/copilot-instructions.md

Net effect: 146 files, +7 / -1146, with no behavioural change.

The 141 no-op cases

The removed constructors were all public Igb<X>() : base() with a single OnCreatedIgb<X>(); statement, so deleting them leaves the compiler-generated public parameterless constructor, which chains to the same base(). Nothing else in the repo referenced the hooks — .github/copilot-instructions.md was the only non-source mention.

One explicit empty parameterless constructor was deliberately left in place: BlazorPlainObjectAttribute in src/componentsBase/BlazorPlainObjectAttribute.cs is not a component, and its constructor carries the documented public API surface for the attribute.

IgbChat

The hook lived in src/componentsBase/WebInputs/Chat.cs and existed purely to force the Options setter to run once at construction:

partial void OnCreatedIgbChat()
{
    // Ensure that Options setter is called to apply the default options and disable input attachments.
    this.Options = new IgbChatOptions();
}

That assignment moved into the constructor in src/components/Blazor/Chat.cs.

IgbTabs

OnCreatedIgbTabs() wrapped a single call to EnsureChangeHandled(), which is what keeps child IgbTab.Selected in sync when the consumer has not subscribed to Change. The call moved directly into the constructor in src/components/Blazor/Tabs.cs, ahead of the existing collection-adapter setup, preserving the original ordering. EnsureChangeHandled() stays in src/componentsBase/WebInputs/Tabs.cs — it is a real method on the partial class, not a hook.

Verification

  • dotnet build IgniteUI.Blazor.Lite.slnx — 0 errors. (6732 warnings, all pre-existing BL0005 noise from the test project setting [Parameter]s directly.)
  • dotnet test tests/IgniteUI.Blazor.Tests -f net8.0881 passed, 0 failed, 22 skipped.
  • grep -r OnCreated src/ — no matches.

Copilot AI review requested due to automatic review settings August 6, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the repo-wide generated pattern of parameterless constructors that only invoked partial void OnCreatedIgb*() hooks, keeping constructors only where they perform real initialization (e.g., IgbChat, IgbTabs). This reduces noise across the generated Blazor wrapper/component and event-args types while preserving runtime behavior.

Changes:

  • Deleted no-op OnCreatedIgb* constructor+hook pairs across many generated component and event-args types.
  • Inlined the previously-implemented OnCreatedIgbChat and OnCreatedIgbTabs logic directly into the corresponding constructors.
  • Updated .github/copilot-instructions.md to stop advertising OnCreatedIgb* hooks as the canonical extensibility mechanism.

Reviewed changes

Copilot reviewed 144 out of 144 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/componentsBase/WebInputs/Tabs.cs Removed the OnCreatedIgbTabs hook implementation (logic moved to constructor).
src/componentsBase/WebInputs/Chat.cs Removed the OnCreatedIgbChat hook implementation (logic moved to constructor).
src/components/Blazor/VoidEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TreeSelectionEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TreeSelectionEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TreeItemComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TreeItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Tree.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Tooltip.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ToggleButton.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Toast.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TileManager.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TileComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TileChangeStateEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/TileChangeStateEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Tile.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ThemeProvider.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Textarea.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Tabs.cs Inlined EnsureChangeHandled() into the constructor; removed OnCreatedIgbTabs hook declaration.
src/components/Blazor/TabComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Tab.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Switch.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Stepper.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Step.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SplitterResizeEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SplitterResizeEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Splitter.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Snackbar.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SliderLabel.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SliderBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Slider.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SelectItemComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SelectItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SelectHeader.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/SelectGroup.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Select.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Ripple.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RatingSymbol.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Rating.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RangeSliderValueEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RangeSliderValue.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RangeSlider.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RadioGroup.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RadioChangeEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/RadioChangeEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Radio.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ProgressBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/NumberFormatSpecifier.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/NumberEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/NavDrawerItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/NavDrawerHeaderItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/NavDrawer.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Navbar.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/MaskInput.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ListItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ListHeader.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/List.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/LinearProgress.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/InputBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Input.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/IconMeta.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/IconButton.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Icon.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/HighlightNavigation.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Highlight.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/FormatSpecifier.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/FocusOptions.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/FilteringOptions.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ExpansionPanelComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ExpansionPanel.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DropdownItemComponentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DropdownItem.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DropdownHeader.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DropdownGroup.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Dropdown.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Divider.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Dialog.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateTimeInputBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateTimeInput.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangeValueEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangeValueDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangeValue.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangePickerResourceStrings.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangePicker.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DateRangeDescriptor.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DatePicker.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/DatePartDeltas.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CustomDateRange.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComponentValueChangedEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComponentDateValueChangedEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComponentDataValueChangedEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComponentBoolValueChangedEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComboChangeEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComboChangeEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ComboBoxBaseLike.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Combo.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CircularProgress.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CircularGradient.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Chip.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CheckboxChangeEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CheckboxChangeEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CheckboxBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Checkbox.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatRenderers.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatRenderContext.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatOptions.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageRenderContext.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageReactionEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageReaction.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageAttachmentEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessageAttachment.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatMessage.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatInputRenderContext.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatDraftMessage.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ChatAttachmentRenderContext.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Chat.cs Inlined options-initialization logic into the constructor; removed OnCreatedIgbChat hook declaration.
src/components/Blazor/CarouselSlide.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CarouselIndicator.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Carousel.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CardMedia.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CardHeader.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CardContent.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CardActions.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Card.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CalendarResourceStrings.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CalendarFormatOptions.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/CalendarBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Calendar.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ButtonGroup.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ButtonBase.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Button.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/BaseOptionLike.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/BaseComboBox.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/BaseAlertLike.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Banner.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Badge.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Avatar.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ActiveStepChangingEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ActiveStepChangingEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ActiveStepChangedEventArgsDetail.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/ActiveStepChangedEventArgs.cs Removed no-op OnCreatedIgb* constructor+hook.
src/components/Blazor/Accordion.cs Removed no-op OnCreatedIgb* constructor+hook.
.github/copilot-instructions.md Updated contribution guidelines to remove mention of OnCreatedIgb* hooks; fixed list indentation.

Comment thread src/components/Blazor/Tabs.cs
@damyanpetev
damyanpetev requested a review from dkamburov August 6, 2026 07:08
@damyanpetev
damyanpetev force-pushed the dpetev/ctor-cleanup branch from d7ef219 to 6ff48b3 Compare August 6, 2026 07:22
@damyanpetev
damyanpetev enabled auto-merge (squash) August 6, 2026 11:26
@damyanpetev
damyanpetev disabled auto-merge August 6, 2026 11:27
@damyanpetev
damyanpetev enabled auto-merge (squash) August 6, 2026 11:27
@damyanpetev
damyanpetev merged commit e847bb3 into master Aug 6, 2026
7 checks passed
@damyanpetev
damyanpetev deleted the dpetev/ctor-cleanup branch August 6, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants