-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
[Bug]: Different behavior of autocomplete in production #5770
Comments
I have basically the same issue. I have an autocomplete with "AutocompleteFilter.Contains", and it contains around 500 elements. If I do a search for a substring, it's matching correctly and showing the correct results when I'm running in Visual Studio. However, as soon as I deploy (even if I deploy on IIS locally and test locally), it gives me incorrect matching results only with "fr-CA" culture. If I switch to "en-CA" culture, it's working fine. I'm on 1.6.2, but I tried on 1.6.1, 1.7.0 and I have the same results. Seeing your screenshot, my guess is that you're using deutch culture with "AutocompleteFilter.Contains". Did you manage to find something relating to this issue? I've been scratching my head over this one. |
I managed to get it working ok by using: |
Thanks, it worked. Instead of using Contains filter, I've switched to "Custom filter" and wrote my filter basically like this:
|
Hey, I am about to solve the issue in Blazorise. The "problem" is located here:
It takes the current culture, which is why it yields different results on different machines (depending on their culture settings). This also explains why a custom filter with (I still don't understand why the search term "re" would yield "Waterjuffer." Maybe it's because "er" is inside, but still...) A few lines below (for
Is there any reason for such a difference, @stsrki? My Proposal:
What do you think? |
I think, @David-Moreira would know better. I believe the difference was by accident. IMO, the [Parameter] public StringComparison StringComparisonCulture { get; set; } = StringComparison.CurrentCultureIgnoreCase; |
Personally I typically always use in String Comparison the InvariantCulture or OrdinalIgnoreCase (mostly the ordinal one, which is the most performant) based variants, as I have found that the culture based comparisons are more niche and haven't really found good usage for these, plus they cost a little bit more compute power. Maybe I just haven't worked in an app/project that had use for it. I must admit I don't fully understand all the intricacies of it, but ordinal based has served me fine in my experience. For example note these: // Current Culture: th-TH // Current Culture: tr-TR For me the lines in bold, I'd just tipically never found a use to have these kind of "culture equality". So in my opinion, I'd make all string based comparisons OrdinalIgnoreCase or Ordinal (depending whether case is important of course!!) , and give a way to override it. Probably the easiest way is to just provide a global Blazorise option, instead of per component. As I'd imagine if someone really needs to apply a culture based comparison he'd want it to be globally done. |
PS: We can decide the definitive approach for string comparison for 2.0 (on a separate task!) |
David has some valid comments. Yeah, for most use cases, And we can introduce more customizations in 2.0 |
Blazorise Version
latest
What Blazorise provider are you running on?
None
Link to minimal reproduction or a simple code snippet
When I run my program in development environment I see this correct behavior:
But when I deploy it on a Linux Azure website I get this strange result:
Steps to reproduce
I did just before a forced clear of caches on both sites
What is expected?
In production the same behavior as in development
What is actually happening?
Wrong filter result
What browsers do you see the problem on?
Chrome (latest)
Any additional comments?
Where should I look for the possible difference between development and production?
The text was updated successfully, but these errors were encountered: