Skip to content

[SupplyParameterFromQuery] property not being set during OnInitializedAsync #53055

@MohamedTwheed

Description

@MohamedTwheed

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After migrating from .net7 to .net8 I encountered an issue that properties with [SupplyParameterFromQuery] not being set druing the OnInitializedAsync only after OnParametersSetAsync.

Ex of the bug:
Navigation with: https://localhost:44340/test?CrumbTrailItemId=662f20c8-b7c1-4145-a8cd-ad693913414a

    [SupplyParameterFromQuery]
    public string CrumbTrailItemId { get; set; }

    protected async Task OnInitializedAsync()
    {
        // this.CrumbTrailItemId  is null
    }

    protected async Task OnParametersSetAsync()
    {
        // this.CrumbTrailItemId  is "662f20c8-b7c1-4145-a8cd-ad693913414a"
    }

Expected Behavior

The property with annotation SupplyParameterFromQuery should be set at the beginning of the life cycle of the component but somehow its being set after OnParametersSetAsync.

Ex of expected behavior:
Navigation with: https://localhost:44340/test?CrumbTrailItemId=662f20c8-b7c1-4145-a8cd-ad693913414a

    [SupplyParameterFromQuery]
    public string CrumbTrailItemId { get; set; }

    protected async Task OnInitializedAsync()
    {
        // this.CrumbTrailItemId  is "662f20c8-b7c1-4145-a8cd-ad693913414a"
    }

Steps To Reproduce

Exceptions (if any)

.NET Version

8.0.0

Anything else?

none

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-model-binding

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions