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

Interactable UI During Exporting in Blazor WebAssembly #58836

Open
DhivyaRajendran opened this issue Nov 8, 2024 · 3 comments
Open

Interactable UI During Exporting in Blazor WebAssembly #58836

DhivyaRajendran opened this issue Nov 8, 2024 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity

Comments

@DhivyaRajendran
Copy link

DhivyaRajendran commented Nov 8, 2024

Describe the bug

Subject: Request for Enhancement: Interactable UI During Exporting in Blazor WebAssembly

Description:

We are encountering a significant challenge with UI interaction in Blazor WebAssembly when performing data exports. Our application handles large datasets (e.g., 10,000 records), and during export operations, the entire web page becomes unresponsive, preventing any further user interaction until the export completes.

In Blazor Server, we have successfully maintained UI responsiveness by utilizing multi-threading with Task.Run, as shown below:

Before:

`csharp

await ExportHelper(GridModel, DataSource);
using MemoryStream outputStream = new MemoryStream();
_workbook.Save(outputStream, IsCsvExport);
`

After:

`csharp

await Task.Run(() => ExportHelper(GridModel, DataSource)).ConfigureAwait(false);

using MemoryStream outputStream = new MemoryStream();

await Task.Run(() => _workbook.Save(outputStream, IsCsvExport)).ConfigureAwait(false);`

While this approach works effectively in Blazor Server, it does not yield the same results in Blazor WebAssembly. The single-threaded nature of WebAssembly causes the export operation to block the UI thread, rendering the page unresponsive.

We have attempted to split the data source and apply Task.Yield in WebAssembly to enhance responsiveness, but these efforts have not been successful.

Expected Behavior

We aim to achieve similar UI responsiveness in Blazor WebAssembly as we experience in Blazor Server, allowing users to interact with the page during export operations.

Request:

We kindly request consideration for adding support for responsive, non-blocking long-running tasks (e.g., data exports) in Blazor WebAssembly. This enhancement would enable us to maintain an interactive UI for end-users.

Environment Details:

Device: DELL Latitude 3410
Browser: Chrome
Blazor WebAssembly Version: 8.0.0

.NET Version

Blazor WebAssembly Version: 8.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 8, 2024
@javiercn
Copy link
Member

javiercn commented Nov 8, 2024

@DhivyaRajendran thanks for contacting us.

This is a dupe of #17730

That said, breaking a long running task into chunks should also work in WebAssembly, there are subtleties on doing so though, if you have a minimal repro project we can probably give you pointers.

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 8, 2024
Copy link
Contributor

Hi @DhivyaRajendran. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

2 participants