GithubHelp home page GithubHelp logo

Comments (10)

MichalLauer avatar MichalLauer commented on July 22, 2024

After a bit of searching, I think this issue could be related to #318 and/or #297.

In the meantine, I also created a codepen reprex which might help further narrow down the issue :)

APenbyMichalLauerBrave2024-04-0316-15-59-ezgif com-video-to-gif-converter

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

@sa-si-dev Could you help on this one?

from virtual-select.

MichalLauer avatar MichalLauer commented on July 22, 2024

So the issue is that there is no call to virtualSelect.setVisibleOptionsCount(...); If this is manually included, there is no longer any issue - see here https://codepen.io/MichalLauer/pen/RwOqWgr.

Would it be possible to fix it somewhere in the package? I am not very familiar with JS project structure so I'm not sure where to include it.

Edit: So there might be something more going on. In my app, I am using a custom regex

function searchLabel(searchValue, virtualSelect) {
  ...
  const regex = new RegExp(`(?<!\S)${word}`, "gi");
  ...
}

and when I call the function virtualSelect.setVisibleOptionsCount(...);, the search no longer respects it and uses the default one. To make it respect the custom function, I need to manually set the counter:

```js
function searchLabel(searchValue, virtualSelect) {
  ...
  virtualSelect.setServerOptions(grouped_data);
  virtualSelect.visibleOptionsCount = visible;
  virtualSelect.afterSetVisibleOptionsCount();
}

The reprex can be found here - https://codepen.io/MichalLauer/pen/wvZQWpe.

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

Hi @MichalLauer
I had a similar issue so I decided to look at the code and try to fix this.
Created a draft PR with a possible solution, could you please help validate this before opening the PR itself (I'm just having some issues running the tests, where 3 are failing, even though I can't manually get any error but would like double check to mitigate the risk of introducing any regression issue)?
You'll need to go ahead and get my branch, build it and use the Dev Tools overrides.

IssueDropdownOnServerSearchFix

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

Hi @MichalLauer
Did you get the chance to test the code from my draft PR?

from virtual-select.

MichalLauer avatar MichalLauer commented on July 22, 2024

Hey,
I tried to build the branch yesterday but could not run any npm run or npm install commands because of authentication. I tried to create an NPM account, but that did not help either. I want to try again on Thursday. Do you have an idea what might have caused it? I tried googling, but nothing helped.

I am not primarily a JS developer, so I'm not very fluent with npm - I just know the basic stuff.

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

Hey, I tried to build the branch yesterday but could not run any npm run or npm install commands because of authentication. I tried to create an NPM account, but that did not help either. I want to try again on Thursday. Do you have an idea what might have caused it? I tried googling, but nothing helped.

I am not primarily a JS developer, so I'm not very fluent with npm - I just know the basic stuff.

Hi @MichalLauer
I didn't have to do anything like that.
You should be able to run npm install and after that npm run build to generate the dist files

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

Fixed in release v1.0.43.

from virtual-select.

MichalLauer avatar MichalLauer commented on July 22, 2024

Hello,

thanks @gnbm for the update and PR! I'm sorry I did not manage to test the changes earlier.

I can confirm that the original issue (https://codepen.io/MichalLauer/pen/RwOqWgr) is fixed. However, a custom regex is still not respected in the version 1.0.43 and the previous code reprex on version 1.0.43 does not work - https://codepen.io/MichalLauer/pen/XWQOVpo.

There, I am using a custom regex to search and return values (line 5). For example, if you search for "c b a", I want to return all items that contain "c", "b", and "a". The regex correctly identifies them and prints them (lines 8 - 10). However, nothing is printed in the virtual select.

Should I create another issue for this?

from virtual-select.

gnbm avatar gnbm commented on July 22, 2024

Hello @MichalLauer
The problem you're reporting is not related to the one you confirmed is fixed, so it should be treated separately.
Being a custom regex and a custom function I would first debug your code to understand if the issue is really in Virtual Select itself.

from virtual-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.