DialogService Component calling OnInitializedAsync Twice

I have a main page that contains a grid. When I click a button the display a dialog component, the OnInitializedAsync method gets called twice for teh dialog component even though I have set preRender to false for the InteractiveServerRender mode on the razor dialog component (and the main page).

I am making a database call when the dialog opens and this is causing the connection to be closed since it is calling it twice so fast. What is going on and how can I make the dialog component not prerender like the main page? I'm guessing it has something to do with it being its own component and the content not in the main razor component but not sure. I guess I could move it to find out.

1 Like

Check if the dialog is not rendered/included twice - i.e. <RadzenDialog /> and <RadzenComponents />. On our demo OnInitializedAsync it's called only once for DialogCardPage.razor.

1 Like

Hmm...yep, they both appear in the MainLayout razor page. Let me try removing one of them.