Skip to content

[Components] Feedback & Reconnect Logic (broken if state is lost) & Internationalization #9737

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

Closed
schmitch opened this issue Apr 25, 2019 · 5 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@schmitch
Copy link

schmitch commented Apr 25, 2019

Hello, currently I'm toying around with Razor Components Server-Side and found the following things when using it with Razor Pages:

  1. If the Server looses a Connection all Messages will be in englisch, currently there should be a way to change that.
  2. reconnect will actually make the whole page unusable, mostly only certain "widgets" should be made unusable. i.e. only the RenderComponentAsync might be unavailable so the rest of the page can still be visible.
  3. reconnect does not work if the state on the signalr is completly lost, the reconnect button just does not work. (if that would be configurable, one could decide to just throw away everything and re-render, this is ok, if the page just contains a small widget that isn't so necessary, or if it is a Datepicker, i.e. the state might be not that necessary)
  4. automatic reconnect is not possible (https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0#improved-signalr-connection-lifetime-handling) withAutomaticReconnect is not available.

I Basically created a small Home Razor Page and tried to run it from Razor Pages (Home.cshtml + Home.cshtml.cs and added endpoints.MapRazorPages()):

Hase

@(await Html.RenderComponentAsync<Counter>())

<script src="_framework/blazor.server.js" autostart="false"></script>
<script>
  Blazor.start({
    configureSignalR: function (builder) {
      builder.configureLogging(2); // LogLevel.Information
      // builder.withAutomaticReconnect(); // this breaks the site
    }
  });
</script>

Most stuff is working, it's just these "small" issues.
Besides that it's just awesome.

@schmitch schmitch changed the title [Components] Reconnect Logic (broken if state is lost) & Internationalization [Components] Feedback & Reconnect Logic (broken if state is lost) & Internationalization Apr 25, 2019
@pranavkm pranavkm added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-blazor Includes: Blazor, Razor Components labels Apr 25, 2019
@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components and removed area-blazor Includes: Blazor, Razor Components labels May 1, 2019
@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@danroth27
Copy link
Member

If the Server looses a Connection all Messages will be in englisch, currently there should be a way to change that.

You can customize the UI to display different text. See https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0#reconnection-to-the-same-server for details.

reconnect will actually make the whole page unusable, mostly only certain "widgets" should be made unusable. i.e. only the RenderComponentAsync might be unavailable so the rest of the page can still be visible.

We're not certain what you mean. Could you please provide some specific repro steps that demonstrate the problem you are seeing?

reconnect does not work if the state on the signalr is completly lost, the reconnect button just does not work. (if that would be configurable, one could decide to just throw away everything and re-render, this is ok, if the page just contains a small widget that isn't so necessary, or if it is a Datepicker, i.e. the state might be not that necessary)

Yes, this is expected, but we do plan to improve the UI to clarify when the state on the server has been lost: #10496. We are also working on providing guidance for how to manage state with server-side Blazor apps in the next milestone: #9734.

automatic reconnect is not possible (https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0#improved-signalr-connection-lifetime-handling) withAutomaticReconnect is not available.

It sounds like you're trying to use the SignalR automatic reconnect feature, but Blazor itself deals with automatic reconnect.

@schmitch
Copy link
Author

schmitch commented Jun 5, 2019

It sounds like you're trying to use the SignalR automatic reconnect feature, but Blazor itself deals with automatic reconnect.

actually than the docs are misleading: https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0#improved-signalr-connection-lifetime-handling

btw. another cool feature would be to have an application that uses either server-side or client-side depending if the client can support wasm. of course that means that some services needs to be different on client/server side but I guess that can be done via DI.

@danroth27
Copy link
Member

actually than the docs are misleading: https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0#improved-signalr-connection-lifetime-handling

Ah, thanks for pointing that out! This content is misplaced (my bad!) and should be part of the SignalR docs. @guardrex

@schmitch
Copy link
Author

schmitch commented Jun 12, 2019

@danroth27 actually I wish that at least components-reconnect-failed would also be available directly as a javascript listener, maybe some people want to reconnect forever (via some kind of backoff).
I mean even the other classes/single modal fails short sometimes when you have two widgets rendered via blazor, but dont want to render the whole page useless.

example (bootstrap, pseudo):

<body>
<div class="row">
<div class="col-1">@(await Html.RenderComponentAsync<Wheater>())</div>
    <div class="col-10">
    <!-- Big Site-->
    </div>
<div class="col-1">@(await Html.RenderComponentAsync<StockExchange>())</div>
</div>
</bod>

with components-reconnect-modal I can render a single widget "as offline" or the whole page, but not both.
(And the use-case I described would also be a good target for a blazor which can use server-side and client-side, depending on the clients support for wasm)

@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @schmitch.
To avoid mixing contexts, please file separate issues per each item on your list, which still require attention.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

4 participants