Skip to content

[Blazor] Consider providing circuits scoped values out of the box #46506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
javiercn opened this issue Feb 7, 2023 · 2 comments
Open

[Blazor] Consider providing circuits scoped values out of the box #46506

javiercn opened this issue Feb 7, 2023 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-server feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Milestone

Comments

@javiercn
Copy link
Member

javiercn commented Feb 7, 2023

It's currently hard to have information available "statically" in the context of a circuit. This is helpful when you need to deal with call sites, libraries, etc. where you can't provide the context and for services that create their own scope.

While adding these types of primitives introduces some risk of misuse, also solves a very common problem that our users face.

It is technically doable to do this today with a hub filter, by wrapping all calls to the Component hub methods and setting up an AsyncLocal variable with the right context, but it is incredibly complicated, savvy, and forces each developer to come up with their own implementation. (We also don't want people writing Hub filters for the component hub).

The idea here is to provide some primitive/abstraction to allow access to state for the circuit. It can be something like an ICircuitContextAccessor (similar to IHttpContextAccessor) or something more low level like a static CircuitLocal<T> type that allows the value to be local to the circuit.

This will make it trivial to implement a handler for things like HttpClient when using HttpClientFactory to access state related to the circuit.

Related to #28684

@javiercn javiercn added feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-server labels Feb 7, 2023
@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Feb 7, 2023
@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone Feb 7, 2023
@ghost
Copy link

ghost commented Feb 7, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, BlazorPlanning Nov 5, 2023
@ghost
Copy link

ghost commented Nov 29, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-server feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Projects
None yet
Development

No branches or pull requests

4 participants