Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send HTML as soon as possible #11

Closed
dvoituron opened this issue Sep 28, 2021 · 1 comment
Closed

Send HTML as soon as possible #11

dvoituron opened this issue Sep 28, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@dvoituron
Copy link
Collaborator

dvoituron commented Sep 28, 2021

For example, if you have a component that is linked to a sub-property, it is better to set default values for all linked properties, instead of testing the initial variable.

// DON'T USE
@if (MyData != null)
{
    <input type="text" value="MyData.Firstname">
}
// PREFERS
<input type="text" value="MyData.Firstname">

@code 
{
     MyData MyData { get; set; } = new MyData();
}

This allows Blazor to send the HTML code to the client who can display it.
Then Blazor, via SignalR, will update the content of the component that is already drawn.
Otherwise, an empty page is displayed to the user, while the whole component is known...
which is not ergonomically pleasant for the user.

@dvoituron
Copy link
Collaborator Author

Th easy way to do that, is to bind to empty objects... including all sub properties must be defined.

@dvoituron dvoituron added the enhancement New feature or request label Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant