-
-
Notifications
You must be signed in to change notification settings - Fork 7
fix: formdata is not updating when options populated dynamically #419
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
base: main
Are you sure you want to change the base?
Conversation
|
Playwright E2E Test Results85 tests 80 ✅ 2m 47s ⏱️ For more details on these failures, see this check. Results for commit 85027e2. ♻️ This comment has been updated with latest results. |
So you're having problem with the form data when using lazy loading? The code looks fine except that you're not actually lazy loading anything in that demo. Did you see the new Lazy Loading - Example that I added recently? I never use form data myself (I typically use |
Oh, sorry for bad explanation. I've found the issue I when tried to lazy-load data, but later found a simple scenario that represents it. This scenario is in my test example. By 'dynamically' I mean just passing In my thoughts, there is solution that will fix my scenario, lazy-loaded options update and, possibly, refreshOptions({ data: newData} ). But I'm afraid of some architectural tricks in lib that prevent it. I'm in progress with codebase investigations 🙃 Of course it's not a problem to check inputs right before auto-submission, detect multiple-select-vanilla'd inputs and use custom js for them. But I think it would be better to keep consistency with web platform and native browser js features. |
hi, @ghiscoding |
// when multiple values could be set, we need to loop through each | ||
Array.from(this.elm.options).forEach(option => { | ||
option.selected = selectedValues.some(val => val === option.value); | ||
option.selected = selectedValues.some(val => val.toString() === option.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct, why are you doing this? It's probably causing some of the test failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I understand, when I try to get value from option tag it's always a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you're right, but I wonder what are the test failures? I didn't try it locally so it's hard to know, but if you roll back this change, does that remove any of the test failures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it was all green before I started.I expect some of them might be fixed in spec files, but have to check carefully
I don't understand why you're adding a new function when there should already be code to do this, for example this code to add all rows multiple-select-vanilla/packages/multiple-select-vanilla/src/MultipleSelectInstance.ts Lines 580 to 583 in 85027e2
So why are you adding a new function? We should be able to reuse the code that already exists and creating a list from an HTML Select is nothing new, the first few examples are using that technique. So I don't understand why you're adding a new function and I would rather use and modify what already exists in the library, that is mainly to avoid making the library larger. |
I've added new function because I didn't see these. Thanks for sharing, I will update my changes. |
Yeah I even don't remember all of the code myself haha, just let me know if you need more assistance in trying to understand some part. The main reason for this function |
@caulfield did you need further help on this PR? I still don't fully understand the problem and the example that you modified doesn't seem to use any lazy loading which is why I don't quite understand the problem |
Hi. Yes. Sorry, there was a lot of other work to do. I will provide more examples to explain the issue |
Hi, thank you for your package, we use it in our work routine 👍
I found a bug when tried to lazy-load data to my control. We use automated way of submitting our forms and selected values were ignored. I reproduce an issue without lazy-load, even only using
data
option from javascript.This is a draft pr with tests only (failed ofc). I continue my work on it tomorrow. Are you okay with that code? Maybe you have some suggestions where I can find the reason..
Thanks in advance