htmlstreamofficial / preline

Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
https://preline.co
Other
4.9k stars 309 forks source link

Advanced Select `removeOption` doesn't work after update #417

Closed umaraziz0 closed 1 month ago

umaraziz0 commented 3 months ago

Summary

Advanced Select add & remove options don't work after update

Steps to Reproduce

Tried using the example component in the docs

  1. Click "Add Three Options" button
  2. Click "Remove values 5,6,7" button
  3. View console for error

Demo Link

https://preline.co/docs/advanced-select.html#add-remove-options

Expected Behavior

Actual Behavior

Seems to occur in single select dropdowns, the multiple select example in the docs has no issue.

This also happens in one of my projects, when I tried upgrading the package version due to this bug: https://github.com/htmlstreamofficial/preline/issues/414 , where in my case no items are removed.

Preline version: ^2.4.1 Chrome version: Version 126.0.6478.185 (Official Build) (arm64)

Screenshots

image

olegpix commented 3 months ago

@umaraziz0 Hi, Thank you for bringing this to our attention, we're appreciate it! As far as I can see this error doesn't affect functionality and you can continue to use this functionality despite the error in the console. We will fix this in the next update. Best regards!

ihorshto commented 2 months ago

Have the same probleme! Preline version: 2.4.1

ihorshto commented 2 months ago

Find a solution to this problem by using try catch construct. So in catch we can handle errors and in finally continue executing the code!

        const endMinutesSelect = HSSelect.getInstance('#minutesEnd');

           try {
                endMinutesSelect.removeOption(optionsToDelete)
            } catch (error) {

            } finally {
                endMinutesSelect.addOption(newOptions);
            }
jahaganiev commented 1 month ago

Hey @umaraziz0 - please check the latest version, the issue has been fixed. Thanks!