Skip to content

Fixed visibility toggling of a horizontal or vertical panel#32

Open
gragra33 wants to merge 1 commit into
carlfranklin:masterfrom
gragra33:update/visibility
Open

Fixed visibility toggling of a horizontal or vertical panel#32
gragra33 wants to merge 1 commit into
carlfranklin:masterfrom
gragra33:update/visibility

Conversation

@gragra33

@gragra33 gragra33 commented Dec 4, 2025

Copy link
Copy Markdown

Added IDisposable implementation to HorizontalSliderPanel and VerticalSliderPanel to properly clean up parent panel references when components are destroyed during conditional rendering, fixing the bug where nested panels would alternately disappear when toggled due to stale parent-child references.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a visibility toggling bug in nested slider panels by implementing proper cleanup through IDisposable. When conditional rendering destroyed and recreated panels, stale parent-child references caused panels to disappear incorrectly. The solution adds IDisposable to both HorizontalSliderPanel and VerticalSliderPanel, ensuring parent references are cleaned up when components are destroyed.

  • Implements IDisposable in HorizontalSliderPanel and VerticalSliderPanel with Dispose methods that clean up parent-child references
  • Adds test pages (Visibility.razor) in both WASM and Server test apps to demonstrate and verify the fix
  • Refactors property declarations to use single-line [Parameter] attribute format for consistency

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
BlazorSliders/VerticalSliderPanel.razor.cs Implements IDisposable and Dispose method to clean up parent references; refactors parameter declarations to single-line format
BlazorSliders/HorizontalSliderPanel.razor.cs Implements IDisposable and Dispose method to clean up parent references; refactors parameter declarations to single-line format
BlazorSlidersWasmTestApp/Pages/Visibility.razor Adds test page demonstrating nested slider panels with conditional rendering to verify the fix
BlazorSlidersWasmTestApp/Pages/NavMenu.razor Adds navigation link to new Visibility test page
BlazorSlidersServerTestApp/Components/Pages/Visibility.razor Adds identical test page for Server test app
BlazorSlidersServerTestApp/Components/Pages/NavMenu.razor Adds navigation link to new Visibility test page
BlazorSliders.sln Updates Visual Studio version metadata

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


protected string TopPanelHeightPx
{
get { return topPanelHeight.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string BottomPanelHeightPx
{
get { return BottomPanelHeight.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.
protected string SliderHeightPx { get { return SliderHeight.ToString() + "px"; } }
protected string BottomPanelTopPx
{
get { return (topPanelHeight + SliderHeight).ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string SliderHeightPx
{
get { return SliderHeight.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string LeftPanelWidthPx
{
get { return leftPanelWidth.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string RightPanelWidthPx
{
get { return RightPanelWidth.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string RightPanelLeftPx
{
get { return (leftPanelWidth + SliderWidth).ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.

protected string SliderWidthPx
{
get { return SliderWidth.ToString() + "px"; }

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Redundant call to 'ToString' on a String object.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants