Bennyboy1973
Bennyboy1973

Reputation: 4281

Does passing a large component around actually use a lot of server resources?

I've made an Avatar component for my gaming page, which since it is required for gaming I've put on the gaming section's layout page.

The Avatar control is quite complex, with several modes for choosing avatars from a gallery, selecting a color palette, and then displaying various versions of the chosen character (animated full-size svg, portrait thumbnail, etc.)

My question is this: if I pass this component as a Cascading Parameter from the layout, am I actually persisting and passing entire rendered components, potentially 200Kb or more, or just a reference to the class with whatever variables I've set, with it only "blowing up" when the component actually needs to be rendered? (I'm guessing the latter)

Or, more importantly, what tools / steps would I need to use to determine for myself what's going on under the hood?

Upvotes: 0

Views: 53

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273844

am I actually persisting and passing entire rendered components

No, there is no need for that

or just a reference to the class

Yes, for the C# part it's just a reference (same size as a long).

[...] "blowing up" when the component actually needs to be rendered?

that depends a little. You have a shadow DOM that is rebuild (where needed) and the differences are applied to the actual DOM by JavaScript.

When you have large changes that could be I/O intensive for Blazor server, but SignalR is quite efficient.

Upvotes: 1

Related Questions