question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Offer Modal Service as a cascading value rather than requiring injection

See original GitHub issue

I’ve been wondering recently whether the modal service being injected is the right thing to do. Looking at the designs from the Blazor team, they favour using cascading values to provide global concerns. AuthenticationState being a good example of this.

The proposal is to provide a CascadingModalService component which can be added at the app level rather than requiring the developer to inject a modal service. Ideally, this would also replace the need for adding the BlazoredModal component to the MainLayout.

I’m interested in others thoughts on this. Do you have any scenarios where an injected service is a necessity over a cascading value? Love to get some feedback on this idea.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
chrissaintycommented, Jun 13, 2020

Yes @larsk2009 that’s it. It just seems like it would solve several reoccurring setup issues we keep seeing, as you’ve pointed out. Without much of a down side. Unless I’ve missed something 🙂

0reactions
MichelJanssoncommented, Sep 1, 2020

@chrissainty Thanks for the lightning fast reply. Ok, interesting none the less.

For me personally, who started using asp.net core last year because Blazor came around, it feels more intuitive to inject external things, and I would not expect to access a external service thru a cascading parameter. One more thing for the toolbox when designing services - thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core Blazor cascading values and parameters
Cascading values and parameters provide a convenient way to flow data down a component hierarchy from an ancestor component to any number of ......
Read more >
Understanding Cascading Values & Cascading Parameters
In this post I provide an overview of cascading values and cascading parameters, what they are, how you can use them and some...
Read more >
How to two way bind a cascading value in Blazor?
You can't do two-way binding with cascading parameters. Cascading means flowing downstream, from parent to child, and not the other way ...
Read more >
<CascadingValues> Doesn't work. What's the alternative?
Hi all, After a week of trying to pass variables down through a Wizard type interface through cascading values, I've (and one of...
Read more >
Custom Authentication in Blazor WebAssembly - Step-By- ...
The idea behind this is that we will not be directly using the service instance in the view (Razor Components), rather we will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found