-
Notifications
You must be signed in to change notification settings - Fork 78
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
noUiSlider (10.1.0): Slider was already initialized. #169
Comments
I'm getting the same problem; were you able to resolve this? I tried forcing the package.json include for my project to be - "nouislider": "14.2.0" - but the SurveyJS widgets seems to pull down the 10.1.0 release regardless. |
Transeferred to the corresponding repo |
My code works fine in SurveyJs 1.5.10, but it breaks in 1.5.11 and above. |
@tDuy Thank you for the additional info. I'm working with this issue right now. It duplicated in this thread also - https://surveyjs.answerdesk.io/ticket/details/t3768/multiple-forms-having-nouislider-results-in-exception-nouislider-10-1-0-slider-was |
I've patched this function and your plunker now works ok for me: function getNoUiSlider(element) {
if (!element)
return null;
// I've added this check for the case if the element holds the noUiSlider instance
if(element.noUiSlider) {
return element.noUiSlider;
}
const $ = window["$"];
var target = $(element).children(".noUi-target");
// console.log("target", target)
// console.log("el", element)
if (target.length) {
return target[0].noUiSlider;
}
return null;
} The function |
I've added original nouislider implementation (https://github.com/surveyjs/widgets/blob/master/src/nouislider.js) into your plunker (https://embed.plnkr.co/plunk/04Ni454pVilIqoTy) and also got the "Slider was already initialized. At this moment I've got the following. For some reason then you are using layout effect function, we've got unexpected call sequence: and indeed leads to the "Slider was already initialized" error and "getNoUiSlider" check. |
For now you can fix the "getNoUiSlider" function as I wrote. On our side we'll investigate the issue. |
I'm not sure, but this surveyjs/survey-library#1998 can be related. Because in your sample you are changing the pages. I leave it here as a note. |
@tsv2013 Please let me know once you resolve the issue. |
v15.5.1, Same issue. |
same issue |
window.onload = () => { |
Are you requesting a feature, reporting a bug or asking a question?
Question
What is the current behavior?
I use panel index to scroll to a specific panel in my questionnaire.
I also create a custom noUiSlider widget.
In 1.5.11 and later versions, I get this error:
Uncaught Error: noUiSlider (10.1.0): Slider was already initialized.
But this error does not happen in 1.5.10 and below.
I tried to destroy the previous noUiSlider element but it still did not work.
Could you take a look at my code?
Thanks.
Provide the test code and the tested page URL (if applicable)
Test code URL:
https://embed.plnkr.co/plunk/04Ni454pVilIqoTy
Specify your
The text was updated successfully, but these errors were encountered: