-
Notifications
You must be signed in to change notification settings - Fork 393
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
fix: Bad performance in Search Interactive when searching through thousands of items #389
Comments
While I accept that the FluentListbox may have a performance issue (which I'll look at), in general I would say that this is not an advised way to work with it this way. If you have thousands of options, use an API to return your results. |
Sounds good that you will look at any There is an old issue for debounce but it was never implemented it seems. Given that they already have a debounce method it does not seem to be that hard to implement. I will look at modifying the SearchInteractive example. If debounce is added natively it would be great if the component was updated as well. Other unrelated findings: For some reason you can only find the search component via URL and not in the components list. Is there any reason for this? Every Blazor example also redirects to https://brave-cliff-0c0c93310.azurestaticapps.net/ instead of https://www.fluentui-blazor.net/ for https://learn.microsoft.com/en-us/fluent-ui/web-components/. |
I wasn't questioning adding a debounce :), just having thousands of items in a listbox.
That one was/is for the React Fluent UI components so that is unfortunately no good for us. It still seems to be on the roadmap for .NET 8 (dotnet/aspnetcore#10522) I'll see where that goes before adding something myself. I just submitted a PR to the docs to add the |
@vnbaaij I can absolutely agree on listbox items :) Sounds good with your PR. I have been looking at this today but something that bothers me is that Moving forward I would either like to modify the FluentSearch component or create a new component called
My component is based on this example: I have tested the component locally and it works the way I expect it. Complete component created that works like the normal
What also works is simply adding the code below to FluentSearch component :
If this is OK this is the best approach imo since there won't be a need to update several components. Is any of these approaches OK and which one do you prefer in that case? |
I prefer to have the 'overriden' approach where the oniput version is part of the demo site. I've done this for the number field as well |
I would prefer to not take that approach. It means that I will have to import the component manually and update it myself if I wish to use it. Could we not add Perhaps a better alternative is using an approach similar to MatBlazor and expose https://www.matblazor.com/TextField If any of the proposed solutions above for some reason are not OK then I can add it to |
I agree. We need to get them in to the library. I'll take a look at the MudBlazor approach and otherwise just AAD them as they are. Think the level of double work will be minimal.
@oninput="@(EventCallback.Factory.CreateBinder<string?>(this, __value => CurrentValueAsString = __value, CurrentValueAsString))" Doing that will lead to double events being raised. Rather have separate components |
After spending three days on this back and forth I think I have found a good solution. Given that you normally want to act on See PR here: #396 Given that we talked about FluentNumberFieldOnInput I found a bug that in turn led to this PR. I hope you will agree that both of these PRs are a good solution @vnbaaij. |
Very happy with this. PR is merged, Thanks Oscar! 💯 🥇 |
I tried many fixes from here. My problem is search functionality works fine. But search textbox doesnt work properly. when typed faster it eats up letter or behaves in any strage way possible. Can anyone help please? |
This is more somethig for the discussion area, I think. Please create a new topic there. |
sure |
🐛 Bug Report
Search interactive is slow when searching through thousands of items.
https://www.fluentui-blazor.net/Search#interactive
Looking at Google Chrome Performance tab it seems Scripting related:
I think it has something to do with the rendering of
FluentListbox
. If this is removedhandleSearchInput
is handled very fast.💻 Repro or Code Sample
🤔 Expected Behavior
Search interactive should work with thousands of items
💁 Possible Solution
A possible solution would be to add a timer to debounce the input like this:
https://blog.jeremylikness.com/blog/an-easier-blazor-debounce/#the-perfect-time
However given that we have all the data loaded it should not be needed. Tried with
MatAutocompleteList
and it has no lag with the same values.🌍 Your Environment
OS & Device:: Windows 11 Pro on PC
Browser: Chrome Version 113.0.5672.64 (Official Build) (64-bit)
.NET 7 and Microsoft.Fast.Components.FluentUI V2.2.1.
The text was updated successfully, but these errors were encountered: