-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Blazor [SupplyParameterFromQuery] not usable in OnInitialized() when navigating [dotnet 8.rc2] #51398
Comments
I tried it out and got the same result - |
@ipax77 do you know if this is something you're experienced only in some rendering mode but not others? |
@mkArtakMSFT the original test was on a Blazor wasm project.
|
Is there any way we can get this bug prioritized higher by the team or @SteveSandersonMS or @surayya-MS. It's a showstopper for our upgrade of watchpedia.com |
so blazor in 8.0 will be completly unusable:( |
This has been addressed by this PR #51279 |
Well, the fix does not work if you are using a non-interactive router in the server project. |
Maybe not unusable, but combined with the state management problem that is also not going to be addressed, it seriously degrades the experience. |
Can confirm this issue exists in dotnet 8.0.100. Parameters provided via [SupplyParameterFromQuery] cannot be used in OnInitialized(Async) at all. They are NOT set on the component prior to OnInitialized being called. From the lifecycle docs here (https://learn.microsoft.com/en-us/aspnet/core/blazor/components/lifecycle?view=aspnetcore-8.0#when-parameters-are-set-setparametersasync): "OnInitialized and OnInitializedAsync are invoked when the component is initialized after having received its initial parameters in SetParametersAsync." This was true in dotnet 7 (I am considered URL query string parameters to be "Initial parameters") but is not working for me in dotnet 8. I could not find any solution other than to manually parse out the parameters inside OnInitialized(Async) where needed. The parameters are eventually set, but they are set in a second call to SetParametersAsync which occurs after OnInitialized(Async). |
+1 confirming this is broken in 8.0.100. I'm using InteractiveWebAssemblyRenderMode with prerender:false. |
I'm also experiencing this issue in 8.0 and 8.0.1, have reverted back to 7 in order to continue developing. |
Back to 7 I go, too. You would think this particular issue would have been tested and identified... |
@surayya-MS is there a way we can re-open this bug report? As of today, using .NET 8.0.200 with Blazor ServerApp we experience the same problem. The properties marked with Our users expect deep linking to work, so we use the Related: #53055 |
It's been added to the 8.0.3 release, haven't seen any expected timelines sadly. I've stuck with 7 up to this point, once this is fixed I'll be able to upgrade to 8 (barring any other issues that testing hasn't found yet) |
I can confirm that it works again with 8.0.3 🎆 👍 |
Thanks for updating us :) I still don't understand how there was not more of an outcry from devs, like me, attempting to upgrade their Blazor project to .Net 8... This issue was a show stopper... |
I can also confirm this is working, the 8.0.3 release has allowed me to upgrade from dot net 7 up to 8 in production now. |
Correct. Why is this issue closed and marked as fixed? Still broken with 8.0.3. |
This issue was confirmed fixed for me in the 8.0.3 release, and in limited testing, appears not to have regressed and still work fine for me in 8.0.4. I’ll do more testing locally of 8.0.4 when I’m back at my desk properly tomorrow |
When Navigating from page A to page B and setting multiple parameters with SupplyParameterFromQuery it works. But if you move on Navigating page B to page C and use different SupplyParameterFromQuery parameters, the parameters comes null. and also parameters set on B are still cached with the same Name property. I tried it on production with 8.0.3 |
8.0.3, Blazor Interactive Server setup: services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.Cookie.HttpOnly = false;
options.LoginPath = "/login";
options.ReturnUrlParameter = "returnUrl";
}); in the component: [SupplyParameterFromQuery]
private string ReturnUrl { get; set; } = "/";
|
Is there an existing issue for this?
Describe the bug
When adding multiple Query strings to a Blazor page they cannot be consumed.
At OnInitialized the parameters are null.
At OnParametersSet they are set
When consuming the parameters in a SubComponent only one Parameter is set / consumable.
Reloading the page and navigating
produce different results, but never all parameters are sets.
Navigate result:
Reload result:
Expected Behavior
The parameters should be consumable at/after page load (e.g. to use them for database requests)
Steps To Reproduce
SampleProject Click on 'Navigate' and reload the page with the parameters.
Exceptions (if any)
No response
.NET Version
8.0.100-rc.2.23502.2
Anything else?
Sample and test with Blazor wasm
The text was updated successfully, but these errors were encountered: