Skip to content

Docs: Fix mangled AppbarButtons.razor.cs merge#11419

Merged
danielchalmers merged 1 commit intoMudBlazor:devfrom
danielchalmers:fix-mangled-appbarbuttons-merge
May 27, 2025
Merged

Docs: Fix mangled AppbarButtons.razor.cs merge#11419
danielchalmers merged 1 commit intoMudBlazor:devfrom
danielchalmers:fix-mangled-appbarbuttons-merge

Conversation

@danielchalmers
Copy link
Member

Description

Broken in #11382

PR 11382 load notifications was put in oninit is why we can't run docs.server.

Huh, there are definitely changes I didn't make or intend to make. Must have been a bad copilot run I didn't revert properly. Will fix

How Has This Been Tested?

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

Copy link
Contributor

Copilot AI left a comment

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 mangled merge in AppbarButtons.razor.cs by reworking the component’s initialization logic. Key changes include replacing OnInitializedAsync with OnAfterRenderAsync for notification loading, removing the LayoutService event subscription, and initializing the _messages dictionary to null instead of an empty dictionary.

Comments suppressed due to low confidence (1)

src/MudBlazor.Docs/Shared/AppbarButtons.razor.cs:59

  • The change to using OnAfterRenderAsync removed the subscription to LayoutService.MajorUpdateOccurred. Please confirm that this removal is intentional and that layout updates no longer need to trigger a UI state update.
protected override async Task OnInitializedAsync()

public partial class AppbarButtons
{
private IDictionary<NotificationMessage, bool> _messages = new Dictionary<NotificationMessage, bool>();
private IDictionary<NotificationMessage, bool> _messages = null;
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

Setting _messages to null may lead to a NullReferenceException if it is accessed before notifications are loaded. Consider initializing it to an empty dictionary or adding null checks where applicable.

Suggested change
private IDictionary<NotificationMessage, bool> _messages = null;
private IDictionary<NotificationMessage, bool> _messages = new Dictionary<NotificationMessage, bool>();

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

Leaving it as it originally was

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels May 27, 2025
@sonarqubecloud
Copy link

Copy link
Contributor

@versile2 versile2 left a comment

Choose a reason for hiding this comment

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

Returned to original, verified works and fixes problem with Docs.Server

@danielchalmers danielchalmers changed the title Fix mangled AppbarButtons.razor.cs merge Docs: Fix mangled AppbarButtons.razor.cs merge May 27, 2025
@danielchalmers danielchalmers merged commit 1b2f81c into MudBlazor:dev May 27, 2025
7 checks passed
@danielchalmers danielchalmers deleted the fix-mangled-appbarbuttons-merge branch May 27, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants