Skip to content

JSRuntime freeze on long calls #21375

Closed
Closed
@vd3d

Description

@vd3d

Describe the bug

In a blazor application, I upload an image from a HTML page, then navigate to the next page a wich to send the image to this razor page.

The problem is that the application freeze (sometimes it work, let say 10% of the cases)

To Reproduce

In a Blazor page, I have 2 pages:

  • uploadimage.html
  • saveimage.razor

In the "uploadimage" I load an image and save it into the local storage with javascript, ie:

    // Save the image
    localStorage.setItem('editor.imageData', imageData);
    // Navigate to the next page
    window.location.assign('/saveimage');

In the razor page, I have the following code:

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
            if (firstRender)
                _imageData = await _jsRuntime.InvokeAsync<string>("localStorage.getItem", "editor.imageData");
    }

But the browser freeze with "attempting to reconnect to the server..."

Further technical details

  • ASP.NET Core 3.1
  • Visual Studio Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions