Skip to content

IDialogService: Forward event DialogInstanceAddedAsync to OnDialogInstanceAdded for compatibility#9431

Merged
ScarletKuro merged 3 commits intoMudBlazor:devfrom
ScarletKuro:dialog_fix
Jul 17, 2024
Merged

IDialogService: Forward event DialogInstanceAddedAsync to OnDialogInstanceAdded for compatibility#9431
ScarletKuro merged 3 commits intoMudBlazor:devfrom
ScarletKuro:dialog_fix

Conversation

@ScarletKuro
Copy link
Member

Description

Fixes: fgilde/MudBlazor.Extensions#98

It's ugly, but there is nothing much I can do, and it's event, if it was a delegate or just typical Func it would be better.

How Has This Been Tested?

Manually by making sure the DialogInstanceAddedAsync is not mandatory to be implemented when implementing the IDialogService.

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.

@codecov
Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.56%. Comparing base (28bc599) to head (6ae26c7).
Report is 1103 commits behind head on dev.

Files with missing lines Patch % Lines
src/MudBlazor/Services/Dialog/IDialogService.cs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9431      +/-   ##
==========================================
+ Coverage   89.82%   90.56%   +0.73%     
==========================================
  Files         412      405       -7     
  Lines       11878    12701     +823     
  Branches     2364     2459      +95     
==========================================
+ Hits        10670    11503     +833     
+ Misses        681      638      -43     
- Partials      527      560      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@henon henon changed the title Dialog fix IDialogService: Forward event DialogInstanceAddedAsync to OnDialogInstanceAdded for compatibility Jul 17, 2024
@henon
Copy link
Contributor

henon commented Jul 17, 2024

I understand forwarding the new event to the old one. But doesn't removing public from the old events break existing code where people rely on the interface to subscribe these two events when using IDialogService as the type of the injected service?

[Inject]
IDialogService DialogService { get; set; }

@ScarletKuro
Copy link
Member Author

I understand forwarding the new event to the old one. But doesn't removing public from the old events break existing code where people rely on the interface to subscribe these two events when using IDialogService as the type of the injected service?

Interface members in C# are public by default. it's a contract.
Explicit visibility should only be defined when you're making a default implementation or logic that shouldn't be visible (again, this is used for the default implementation).
Before C# 8.0, it wasn't possible to set the public keyword, and this is the exception you'd get:
Prior8

Adding the public keyword to members without default implementation doesn't do any harm, I just find it incorrect language usage since it was intended solely for dealing with default implementations, and here we have only one such member.

@henon
Copy link
Contributor

henon commented Jul 17, 2024

Understood. Thanks for explaining ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regression Previously worked and now doesn't

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MudExDialogService does not implement new

3 participants