Skip to content

MudTable: Use InvokeAsync() in method InvokeServerLoadFunc#9261

Merged
ScarletKuro merged 1 commit into
MudBlazor:devfrom
Int32Overflow:mudtable_fix_invokeasync
Jun 28, 2024
Merged

MudTable: Use InvokeAsync() in method InvokeServerLoadFunc#9261
ScarletKuro merged 1 commit into
MudBlazor:devfrom
Int32Overflow:mudtable_fix_invokeasync

Conversation

@Int32Overflow

Copy link
Copy Markdown
Contributor

Description

In the MudTable class, there are two method calls of StateHasChanged in the InvokeServerLoadFunc method. One with InvokeAsync() and the other without.

The following error occurs:

 Unhandled exception in circuit 'csdeJXMxhUv92EmWV4I-aQzC5uulQQa6FuQ0HbD5svg'.
      System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
         at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
         at MudBlazor.MudTable`1.InvokeServerLoadFunc()

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions Bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Jun 27, 2024
@codecov

codecov Bot commented Jun 27, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.99%. Comparing base (28bc599) to head (da96ab1).
Report is 299 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9261      +/-   ##
==========================================
+ Coverage   89.82%   90.99%   +1.16%     
==========================================
  Files         412      403       -9     
  Lines       11878    12560     +682     
  Branches     2364     2439      +75     
==========================================
+ Hits        10670    11429     +759     
+ Misses        681      594      -87     
- Partials      527      537      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ScarletKuro

Copy link
Copy Markdown
Member

Kind of curious to know why the InvokeServerLoadFunc wouldn't run on the UI thread, but this change makes sense for consistency anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants