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
To test pure Blazor SSR, I removed Blazor JS from the layout and modified the Weather component to remove the null check for the forecasts array in the markup.
When I ran the project, I encountered a Null Reference Exception (NRE). This is expected, as in the server or WASM model, it appears that the markup is being evaluated before the OnInitializedAsync task is completed.
I can fix this by simply checking if forecasts is not null, which works. However, while the response is not streamed, it takes some time for the rendered HTML to appear in my browser.
My question is: while the HTML is being evaluated on the server before being sent to the browser, how does the server know when to send the response? How does it know it should wait for the OnInitializedAsync method to finish?
If I try to update the component state, for example via an event, it doesn't work because it only sends the HTML once, so the interaction won't work. However, while it waits for OnInitializedAsync to finish, why doesn't it wait for other state changes? Obviously, it is impossible to predict future state changes, so how does Blazor SSR know when to send the data to the browser?
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
-
To test pure Blazor SSR, I removed Blazor JS from the layout and modified the
Weather
component to remove the null check for theforecasts
array in the markup.When I ran the project, I encountered a Null Reference Exception (NRE). This is expected, as in the server or WASM model, it appears that the markup is being evaluated before the
OnInitializedAsync
task is completed.I can fix this by simply checking if forecasts is not null, which works. However, while the response is not streamed, it takes some time for the rendered HTML to appear in my browser.
My question is: while the HTML is being evaluated on the server before being sent to the browser, how does the server know when to send the response? How does it know it should wait for the
OnInitializedAsync
method to finish?If I try to update the component state, for example via an event, it doesn't work because it only sends the HTML once, so the interaction won't work. However, while it waits for OnInitializedAsync to finish, why doesn't it wait for other state changes? Obviously, it is impossible to predict future state changes, so how does Blazor SSR know when to send the data to the browser?
Beta Was this translation helpful? Give feedback.
All reactions