dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.36k stars 9.99k forks source link

3.1 Blazor - Order of elements changes unexpectedly #17570

Closed ctolkien closed 4 years ago

ctolkien commented 4 years ago

Describe the bug

Having certain multiple of Components embedded on a razor pages using EditForm and using a model which is (potentially?) a primitive type causes the first instance of the component to render using a non-deterministic order.

This is hard to explain - watch here: https://1drv.ms/v/s!An11vYV7OnV4psZ2ga9UCe_QyYbXJA

To Reproduce

https://github.com/Soda-Digital/blazor-repro-order-elements-change-unexpectedly

Further technical details

Blazor 3.1

javiercn commented 4 years ago

@ctolkien thanks for contacting us.

@SteveSandersonMS can you take a look?

SteveSandersonMS commented 4 years ago

Thanks very much @ctolkien for reporting this and for providing a clear repro.

It definitely looks like a bug. I've filed a report with more info (reflecting this initial investigation) at https://github.com/aspnet/AspNetCore/issues/17851, so for housekeeping purposes I'm going to close this issue as a duplicate of that one. We'll look into finding a fix for it.

In the meantime, I'd recommend using your workaround of wrapping a <div> or some other element around each use of <component>.