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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: A second operation was started in DataGrid with EF Core #801
Comments
I'm using v3.1.0 with no issue utilizing pagination. However, I do not set my context in OnInitializedAsync(). // Update _context field and remove relevant code from OnInitializedAsync()
private ApplicationContext? _context => ContextFactory.CreateDbContext(); |
@joecuevasjr thanks for your comment, but I'm creating a context per operation (asynchronously): |
I have very little experience with EF Core. The code for the adapter is almost a one one one copy of what is used with QuickGrid. Would be interesting to see if QuickGrid showed the same behavior |
@davidkudera when the OnInitializedAsync method is called it's only once per component lifetime. It won't rerun for every operation in the component. The call to CreateDbContextAsync() is currently set up as a one time setup when it should be per operation, such as when the data is fetched for the datgrid. |
We're having the same issue. Downgrading from v3.1.1 to v3.0.1 services.AddDbContext<OurDbContext>(options => options.UseSqlServer(connectionString)); And then make use of wrapper classes to expose the entities to the page: IQueryable<Customer> customers = Enumerable.Empty<Customer>().AsQueryable();
protected override async Task OnInitializedAsync()
{
customers = CustomerService.List();
} Where List() returns the DB set.
|
The QuickGrid documentation on using EF-Core IQueryable shows the following code example as the simplest and most performant option for EF Core: @inject ApplicationDbContext MyDbContext
<QuickGrid Items="@MyDbContext.People">
...
</QuickGrid> |
Thanks @joecuevasjr - do you know when MyDbContext will be disposed of in that implementation? |
@joecuevasjr correct me if I'm wrong, but calling Items.Count without making use of the asyncQueryExecutor is going to be causing this issue:
v3.0.1 does not have the empty check which v3.1.1 does, in which Item.Count is being called - might explain why v3.0.1 works for the most part?
|
@malcolmvs I don't understand. How can I use the v3.0.1 indeed does not have the empty check because that version did not have the |
Apologies @vnbaaij I see my comment is unclear. What I was trying to say is that by looking at the code I can see that asyncQueryExecutor needs to be used any time a count of the items is needed (IF the asyncQueryExecutor has been set). Thus the following code will cause an issue as it doesn't take the asyncQueryExecutor into consideration:
I do believe you could use |
I think I can fix this by removing the
with _ariaBodyRowCount = totalItemCount; .
Sounds good? |
* Add UnitTests markdown page (#658) * ProgressToast related cahnges (#657) * FluentProgress: Add ValueChanged FluentProgressRing: Add ValueChanged Fix #655 and update example * Do not use @Bind for FluentProgress Value Update example * Add colocated files to demos * Undo add ValueChanged EventCallBack * Add Width and Height property and associated styles (#663) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Point to unit test documentation * re-add fixed to DemoSection tabs * #624 Change NavMneu to use Icon Value Update version in banner * Update version in props * Fix Icons and Emojis trimmed during the WASM publishing process (#666) * FluentMessageBox: enable not supplying an icon to the body * Add doc about Icons / Emojis (#673) * Fix click not working on FluentTreeItem text (#667) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Fix the Tooltip used by the FluentOverflow (#678) * Revert change in including web-components script. fix #668 Update Icon example * Fix TextField AutoComplete property to a string property (#682) * Fix #674 (#676) * Fix DemoSection label sometimes wrong * Fix #621 - Add aria-hidden to clear-button (#683) Fix some search sample a11y issues * Make FLuentToastContainer work better on mobile devices (was #684) * Replace the Icons.AllIcons property with a GetAllIcons method using reflection (#685) * Users/vnbaaij/update templates (#688) * Update templates t0 use v3 package * More template updates Temp add global.json to pin 8.0.0-preview.7 * Set icon for EF Adapter package * Fix EF Adapter Icon path * Apply the oninput attribute to "text" components (#696) * Add missing usings Project template (#702) Fixes #701 * Fix templates missing using (beacause of Code CLeanup runningon save...) * Remove PackageVersion from csproj to let it be set y pipeline * Add item reference to FluentDataGridRow and FluentDataGridCell (#695) (#700) Co-authored-by: Alessio Dell鈥橝quila <aquila@hks-systeme.de> * [fix] multiline-text word-break (#711) * [fix] multiline-text word-break * test * Add FluentDialogHeader, FluentDialogFooter and related updates (#717) * Update build-core-lib.yml * Add MessageBar component (#718) * Add MessageBar * Demo site optimizations * Add generic ActionLink and ActionButton classes * Tune display of ApiDocumentation on smaller screens * Users/dvoituron/autocomplete (#720) * Draft version of Autocomplete component * Autocomplete with basic features * Update some UI details * Add ArrowUp/ArrowDown to select items * Add TemplateOption * Add Demo styles * Add Header and Footer content * Add FluentOptionPeople component * Finalize unsing People Component * Add some aria attributes (not completed) * Add face picture samples * Revert ToC panel * Add first tests * Fix Unit Test * Fix Unit Test * Add Unit Tests * Fix the complexity * Add Unit Tests for FluentOptionPeople component * FluentDataGridRow: sticky header z-index. Fix #721 * Use latest .NET SDKs Fix null dereference warning Remove global.json * Fix issue with combined normal/timed MessageBars * Put notification/settings icons in a button * Update the DatePicker popup position (#724) * [FluentAutocomplete] Update some usabilities (#725) * Add MaximumSelectedOptionsMessage, a Search icon and a Dismiss icon * Update Unit Tests * Fix FluentDatePicker and FluentTimePicker to keep existing date/time values (#726) * FluentMenuButton: Add ButtonStyle and MenuStyle parameters * Couple of enhancements (#727) * Fix issue with combined normal/timed MessageBars * Put notification/settings icons in a button * FluentMenuButton: Add ButtonStyle and MenuStyle parameters * Add ChildContent (#728) * Fix MessageOption Timeout xml documentation * Update CodeSetup.md (#730) Fix a typo * [FluentMenu/FluentPopover/FluentOverlay] Close menu/popover automatically when user clicks outside of it (by using overlay) (#729) * Fix FluentMenu / FluentOverlay to dismiss menu when clicked outside * Fix FluentPopover/FluentOverlay * Apply naming conventions * Add `EmptyContent` parameter to the DataGrid (#731) * Fix MessageOption Timeout xml documentation * Add a EmptyContent parameter to FluentDataGrid * [FluentPresenceBadge & FluentOptionPeople] - Update the Status badge to be compliant FluentUI 2 (#732) * Fix people ChildContent * Update the FluentPresenceBadge * Update the FluentOptionPeople * Fix Unit Tests * Fix Unit Tests --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Add more colors to OfficeColor enum * Add a comment on FluentTabPage on styling indicator * [CssBuilder and StyleBuilder] Fixing the built format and position of the custom styles (#745) * Refactor StyleBuilder and add Unit Tests * Update CssBuilder and StyleBuilder * Update the CSS and Style Builder to include custom user styles at the end * Update all existing classes * Fix Unit Tests * Add comment to ComboboxPage Update some xml doc comments * Update FluentDataGridRow and example (#747) * Add a column with buttons to virtualized grid example with sticky header Update FluentDataGridRow to align center when row height is set Update FluentDataGrid to remove code that was already done in row rendering * Process review remark * fix typos (#751) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Update the Button.Loading when using with a Icon (#752) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Dialog enhancements (add dialog type, fix panel width setable), add MaxHeight to DemoSection (#740) * Add Dialog custom header/footer example Address #739 Change ShowDialog to allow horizontal alignment setting * Add DialogType enum and set this in dialog parameters Use width parameter in panel example * Fix review comments Add MaxHeight to DemoSection * REmove files no longer needed * Cleanup for new alternative * Make DialogType internal * Revert "Make DialogType internal" This reverts commit e80e451. * Remove more HeaderTemplate/FooterTemplate references * Fix NavMenu route/subroute not selecting correct item (#755) * Fix NavMenu route/subroute not selecting correct item * Fix compilation error * Add extra "/" (if needed) to do a clean comparisson on segments * [FluentDialog] Include components to customize the Dialog-box (#764) * Update Fluent UI System Icons to 1.1.217 (#765) Move AllIcons property Comment out Icons.cs creation in generator * Add PreventScroll to Dialog and Overlay (#758) * Add PreventScroll to Dialog and Overlay * Move scroll restauration to DisposeAsync * Change it to use a CSS only approach * Fix manual dialog with PreventScroll * Rename FluentOptionPeople to FluentPersona (#766) * Rename FluentOptionPeople to FluentPersona * Update tests * Update version Test for #771 Fix #772 * Fix #772 (for real this time...) * Typo 'the the' (#773) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Add InlineStyleBuilder and fix the FluentSelect.Height property (#774) * [FluentIcon] Use of Value attribute (not Icon) (#784) * [WIP] Inert modal overlay (#783) * Fix #772 * add InertModalOverlay to DialogParameters --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Rename InertModalOverlay to PreventDismissOnOverlayClick Fix code comment Clean up demo description Extend sample with custom dialog to usee new parameter * Fix NavMenu redirecting tosmae page when route parameters present (#755) Fix obsolete warning for Notification Center * Fix obsolete warnings Update Whatsew, add What's New Archive * Re-work padding/height for dialog variants (#786) * Re-work padding/heigt for dialog variants * Resolve review comments * Fix more Obsolete warnings Fix one more issue related to #755 * Add a Tooltip parameter to DataGrid columns (#791) * Add Tooltip parameter to DataGrid columns Clean-up WhatsNew * More tooltip work Add Style parameter to ColumnBase ApiDocumentation: InstanceType renamed to InstanceTypes and is array now * Fix #789 * Button and Icon colors (#793) * Add Icon.WithColor and update the Demo page * Update Button Icon Color depending of Button Appearance * Update the way to apply the Icon.Color in a Button --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * fix: enhanced DialogService doc with asp.net core 8 with ssr (#795) * Update Fluent UI System Icons to 1.1.218 Add What's New file to Icons * Remove generated Icons.cs file * Update version for preview site footer * Fix the Icon Color doc page (#796) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Fix MessageBar issues (#797) * Implement MessageService OnMessageItemsUpdatedAsync handler Rename OnAlertUpdateHandler to OnMessageItemsUpdatedHandler * Make Title and Link nullable and don't render them when they are null Adapt sample to show this situation * Process review remarks * Fix #805: InlineStyleBuilder on .NET6 (#806) * corrects minor typo (#804) Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Several changes and fixes (#802) * Fix #800 by doing more checks. Tooltip example uses DemoLogger now Tooltip: add delegate check TemplateColumn: Add TooltipText parameter * Add TooltipText to PropertyColumn + refactor Extend DataGrid example to show tooltip usage Fix comment issue Fix MessageBar test * Fix Server site Flash of Unstyled Content Add soem code to IssueTester to test navigation menu issues * Change ColumBase button aria-label * Add route parameters test to lab page * NavMenu: Add ReNvigate parameter * Change when ReNavigate gets passed * Better ReNavigate implementation Also added remark on commented code * Fixes SimpleCustomizedDialog.razor (#807) * corrects minor typo * fixes typo in comments * fix by restoring SimpleCustomizedDialog.razor --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Fix FluentDataGrid error if page is quickly exited (#810) * [FluentInputFile] Fix the manual upload on iOS (#815) * Update the manual upload on iOS * Keep ShowFilesDialogAsync * fixes minor typo (#824) * Fix README.md minor typo (#827) * Update README.md - typo (#829) Fix a typo * FluentSelect: Fix ValueChanged fired twice (#828) * FluentSelect: Fix ValueChanged fired twice * Override Person.ToString() to not return image data * Process review remarks * 1) Fix error in RenderDefaultHeaderContent related to recent tooltip work 2) Udo country code rename * Fix #801 by removing direct call to Items.Count() (#831) * FluentCard: Add AreaRestricted parameter (#830) * FluentCard: Add AreaRestricted parameter, update docs, tests and examples * Update build-demo.yml * Update build-demo.yml * Update build-demo.yml * Update build-demo.yml * Error message updated when FluentDialogProvider is missing (#832) * New NavMenu, NavGroup and NavLink components (#819) * new FluentNavMenu, FluentNavGroup and FluentNavLink component * Rename earlier FluentNavMenu to FluentNavMenuTree * Update documentation, copy examples and add upgrade guide * Fix #816 * Fix #811 * Add NavMenu components tests * CounterBadge tests * [Input Label] FluentInputLabel Add a Label and update aria-label (#822) * Add a new FluentInputLabel component to display a label and to update the aria-label of the associated Input component * Update for List components * Update all Input samples * Add a property LabelTemplate * Rename Title property to AriaLabel --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * fix: chinese abbreviated day name in FluentCalendar (#834) * [fix] chinese day abbreviated name * [fix] add ToAbbreviatedDisplay summary * [fix] revert to string * [fix] use ShortestDayNames instead of AbbreviatedDayNames * [fix] rename variable * [fix] rename, add Abbreviated to tuple * [fix] remove empty line * [fix] remove empty line --------- Co-authored-by: Vincent Baaij <vnbaaij@outlook.com> * Minor documentation corrections (#837) * corrects comment * Reworded to improve clarity * Corrects comments - removes / * Fix #836 * Prepare for release - update whatsnew docs * More whatsnew updates --------- Co-authored-by: Denis Voituron <dvoituron@outlook.com> Co-authored-by: Emanuele Curati <ema@outlook.com> Co-authored-by: Antoine Griffard <agriffard@hotmail.com> Co-authored-by: hksalessio <143792830+hksalessio@users.noreply.github.com> Co-authored-by: Alessio Dell鈥橝quila <aquila@hks-systeme.de> Co-authored-by: ssccinng <whs11998@163.com> Co-authored-by: Yue Cui <37979368+LuohuaRain@users.noreply.github.com> Co-authored-by: Gary Chan <gary.chan@c0g1t8.com> Co-authored-by: James Newton-King <james@newtonking.com> Co-authored-by: Alexis Narvaez <anarvaez@fullstacklabs.co> Co-authored-by: Harry Pfleger <harry@ardimedia.com>
@vnbaaij I have the same problem but in my case it is happening if I double click on sorting the column, meaning it executes two operations fast. I'm using basic implementation for testing, without paging or anything additional. Do you have an idea how can I prevent this? @inject ApplicationDbContext DbContext
<FluentDataGrid Items="@DbContext.Users">
<PropertyColumn Property="@(u => u.Email)" Sortable="true" Align="Align.Start" />
<PropertyColumn Property="@(u => u.UserName)" Sortable="true" Align="Align.Start" />
</FluentDataGrid> |
I have similar problem with my QuickGrid component... When use pagination="true" the request is twice, otherwise the request is single. My problem is that if I click on a button that for example opens a modal, itemprovider its fired, but if i click to sort one column and then try to press the button again, itemsprovide is not fired. So everytime I must to sort something , search something or change page inside the quickgrid componet to avoid that itemsproviders to fire I tried different methods to avoid this but without success. |
馃悰 Bug Report
DataGrid with Paginator in version 3.1.0 and 3.1.1 fails with the following error:
Sometimes it loads the first time after starting the app but fails on the next request.
馃捇 Repro or Code Sample
馃 Expected Behavior
Not to fail.
馃槸 Current Behavior
馃拋 Possible Solution
Downgrade to version 3.0.1
馃敠 Context
Print a simple DataGrid with data from
DbSet
.馃實 Your Environment
The text was updated successfully, but these errors were encountered: