Skip to content

Conversation

@guardrex
Copy link
Collaborator

@guardrex guardrex commented Sep 4, 2020

Fixes #15373

Internal Review Topic (links to section)

😕 ... I've run into a point of confusion that's even blocking this PR ...

Our content implies (and I was under the assumption) that when autostart="false" is placed on the script that calling Blazor.start() is absolutely required to get the app going. Testing here seems to indicate that that's not so. When I set the _Host.cshtml page up with only the following ...

<script autostart="false" src="_framework/blazor.server.js"></script>

and no call to Blazor.start(), the app still starts and runs normally, which I don't expect to happen.

What am I missing? ..... I'll adjust the PR accordingly to head off the (my 😄) confusion.

@captainsafia
Copy link
Member

@guardrex Content here looks good.

I wasn't able to reproduce the issue you cited. My repro steps are as follows:

  1. Create new project via dotnet new blazorserver -o AutostartTest
  2. Modify Pages/_Host.cshtml to set autostart='false'.
  3. Observe that the circuit isn't initialized.

This was on 5.0.100-rc.1.20431.3.

Is there a chance that you have a Blazor.start invocation somewhere else in the code?

@guardrex
Copy link
Collaborator Author

guardrex commented Sep 7, 2020

"Circuit" ... I expected to see the warning bar that a circuit hasn't been established. Turns out that there's no indication ... just everything that would depend on the circuit no-ops. Therefore, I'd like to look again at the text here. It should probably say somehow explicitly that "start" in Blazor.start and autostart refers to 'starting the circuit' and perhaps that only functionality that depends on the circuit is impacted by a disabled circuit ... something like that ... I'll work on the wording. I'll update it tomorrow (Tuesday) morning and ping u back.

@guardrex
Copy link
Collaborator Author

guardrex commented Sep 8, 2020

@captainsafia ... Here's the latest opening remarks of that section ...

Configure the manual start of a Blazor Server app's [SignalR circuit](xref:blazor/hosting-models#circuits) in the `Pages/_Host.cshtml` file:

  • Add an `autostart="false"` attribute to the `<script>` tag for the `blazor.server.js` script.
  • Place a script that calls `Blazor.start` after the `blazor.server.js` script's tag and inside the closing `</body>` tag.

When `autostart` is disabled, any aspect of the app that doesn't depend on the circuit works normally. For example, client-side routing is operational. However, any aspect that depends on the circuit isn't operational until `Blazor.start` is called. For example, component methods fail to execute while the circuit is disconnected.

@guardrex
Copy link
Collaborator Author

guardrex commented Sep 9, 2020

@captainsafia ... does this look good ☝️?

Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice additions! Left some feedback inline.

@guardrex
Copy link
Collaborator Author

guardrex commented Sep 9, 2020

@captainsafia ... Confirm the CSS ... is this correct ...

#components-reconnect-modal {
    transition: visibility 0s linear 500ms;
}

Nevermind ... got it ... looks correct based on dotnet/aspnetcore#24566.

@guardrex guardrex merged commit ff4e300 into master Sep 9, 2020
@guardrex guardrex deleted the guardrex/blazor-hosting-models branch September 9, 2020 23:24
@scottaddie scottaddie changed the title Enhance Blazor start content Enhance Blazor hosting model configuration content Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename and expand the Configure the SignalR client for Blazor Server apps to cover more cases

3 participants