You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mainly regarding Blazor Server in my case, but most probably also applies to Blazor Wasm:
When the application gets loaded initially, it is rendered twice.
The first time the app is loaded, the navigated-to page is pre-rendered on the server, and then, after the page was sent to the browser, the SignalR connection gets created. This creates a new circuit, and then the page is rendered again in the context of the circuit and updates in the browser.
This are, of course, different instances of the components, so state is not shared between the initial pre-rendering components and the components that are bound to the actual lifetime of the circuit.
Now, as you can deep-link into the application, it is possible that dynamic state is shown, and if loading of that data takes a second or so, the page loads, shows some data, and after a second or two state changes as updated state is loaded.
This is not exactly the best user experience and also imposes additional, unnecessary load on the server, as it has to load the same data twice.
So what is the suggested way to keep state between these two render passes, so that initially loaded data is not loaded again on the second pass.
Or, alternatively, what is the suggested way to prevent certain stuff that creates state from happening on the initial "pure html" rendering, so that we can i.e. render a loading progress bar at inital server-side rendering, and then do the actual loading of data when the circuit is established and we then can hold the loaded in the component state?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is directed @SteveSandersonMS
Mainly regarding Blazor Server in my case, but most probably also applies to Blazor Wasm:
When the application gets loaded initially, it is rendered twice.
The first time the app is loaded, the navigated-to page is pre-rendered on the server, and then, after the page was sent to the browser, the SignalR connection gets created. This creates a new circuit, and then the page is rendered again in the context of the circuit and updates in the browser.
This are, of course, different instances of the components, so state is not shared between the initial pre-rendering components and the components that are bound to the actual lifetime of the circuit.
Now, as you can deep-link into the application, it is possible that dynamic state is shown, and if loading of that data takes a second or so, the page loads, shows some data, and after a second or two state changes as updated state is loaded.
This is not exactly the best user experience and also imposes additional, unnecessary load on the server, as it has to load the same data twice.
So what is the suggested way to keep state between these two render passes, so that initially loaded data is not loaded again on the second pass.
Or, alternatively, what is the suggested way to prevent certain stuff that creates state from happening on the initial "pure html" rendering, so that we can i.e. render a loading progress bar at inital server-side rendering, and then do the actual loading of data when the circuit is established and we then can hold the loaded in the component state?
Beta Was this translation helpful? Give feedback.
All reactions