Caleb Weeks
Data fetching in components?
Oh, that's an interesting idea. I could have a variation of the DataContextComponent that creates a new dbContext every time OnParametersSetAsync gets called. I think I'll look more into the Cancellation token approach. In this case, I need the value from the parameter in order to do the data fetching. Thanks for the help!
13 replies
Data fetching in components?
Alright, I spent some time this morning making a minimal reproduction of the error and have determined that it's not caused by the parent and child components both using dbContext. It has more to do with OnParametersSetAsync being called twice in rapid succession on a component with a @bind-Value directive. Here's some code that causes the error:
[Parent.razor]
[Child.razor]
13 replies
Data fetching in components?
It might be important... I'm fairly new to C# and OOP in general, so I thought I needed to make it partial so that the inheriting class had access to the protected dbContext. I'll put together a minimal example tomorrow morning.
13 replies
Data fetching in components?
Thanks for the response! Somehow I missed this message until just now. My implementation looks very similar. It's been working for the most part, but when I tried fetching data in OnParametersSetAsync in the child component, I'm getting that error. If I move the data loading to OnInitializedAsync in the child component or comment out the data fetching in the parent component, the error goes away. So it has something to do with the interaction between the two components.
13 replies
Using Blazor WebAssembly for client interactions in Blazor Server
Thanks! I'll look into that more. This repo is what gets generated when using Radzen Blazor Studio. I like how it's set up with the layout in the client side, but I just need the nav menu to be generated on the server. https://github.com/sethcalebweeks/RadzenBlazorAuto
7 replies
Using Blazor WebAssembly for client interactions in Blazor Server
Thanks! I'm familiar with the render modes. I'm looking for architectural advice on the best way of adding small client side interactions. I'd like to use Blazor WebAssembly, but it seems like nesting Server components in WebAssembly components isn't possible.
7 replies