jsPsych icon indicating copy to clipboard operation
jsPsych copied to clipboard

Update SurveyJS version

Open becky-gilbert opened this issue 6 months ago â€ĸ 1 comments

Fixes #3549

This PR makes the following updates to the jsPsych survey plugin:

  • Updates the survey-core version from 1.9.138 to 2.2.0
  • Changes the SurveyJS UI package from survey-knockout-ui (removed in SurveyJS v2) to survey-js-ui
  • Makes SurveyJS v1 -> v2 code migration changes:
    • CSS file name changed to "survey-core/survey-core.min.css"
    • SurveyJS.Survey from survey-knockout-ui package is replaced with Model from survey-core
  • Adds a minified version of the survey.css file to the build output and loads it in the plugin example files
  • In the docs and example files, updates the button_html parameter value from a string to a function (for button-response v2 migration)
  • Hides a rollup build warning due to the use of top-level this by SurveyJS
  • Adds a resizeObserver mock to fix broken tests

To do

  • Fix broken example "dynamically_generating_content.html" (I'm not sure yet why this is broken)
  • Update docs and add example for the new slider scale feature (requested in #3549)
  • Figure out what all of the researcher-facing changes are and add them to the changeset and docs.

Question

Should this be a major or minor bump? I went with minor due to the availability of new features, such as the slider scale. There have been breaking changes as part of the SurveyJS v1 -> v2 update, but I'm not sure yet if there are any breaking changes for jsPsych users (vs developers).

becky-gilbert avatar Jun 13 '25 22:06 becky-gilbert

đŸĻ‹ Changeset detected

Latest commit: 2bdc6b8969f3b27994bef30e318a03691f975074

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@jspsych/plugin-survey Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 13 '25 22:06 changeset-bot[bot]

Is there anything else we can do to help this get merged?

DominiqueMakowski avatar Jun 23 '25 20:06 DominiqueMakowski

@DominiqueMakowski Sorry that this is taking so long â˜šī¸ I'm debugging a problem with multiple survey trials that was caused by this update. What's happening is that, when the experiment has a survey trial that repeats with timeline variables, it is breaking on the second survey trial (nothing appears on the page and there are no errors). I checked that it is possible to run multiple survey trials in the same experiment with this updated version, as long as they are sufficiently different. The rendering only breaks on the second trial when it is very similar in structure to the first (e.g. when using a repeated JSON structure and different text values). My best guess is that SurveyJS is deciding it doesn't need to render the survey again because of state/caching issues. I hope that I'm on the right track with debugging this. I would love to hear other thoughts/suggestions!

becky-gilbert avatar Jun 26 '25 21:06 becky-gilbert

calling super-@Max-Lovell maybehe has an idea

Do you have a minimal example to reproduce the issue?

DominiqueMakowski avatar Jun 26 '25 21:06 DominiqueMakowski

Oh I think I just figured it out. It works when I create a new div element for the survey to render into. It seems like SurveyJS doesn't like rendering into the same DOM container again (at least when the survey content is too similar..? I don't know). Anyway I will clean this up and push the update here ASAP.

And in case Max or anyone else wants to have a look - the reproducible example is "dynamically_generating_content.html" from the plugin examples folder. Also, the "jspsych-survey-demo6.html" example from docs/demos is a counter-example showing that this updated version can sometimes render multiple survey trials on the same page (I assume this example works because the JSON structures are different enough across trials, but I'm not totally sure).

becky-gilbert avatar Jun 26 '25 21:06 becky-gilbert

@jodeleeuw @cherriechang I'm updating the docs for this survey plugin release. Should I update the unpkg version numbers in the docs in this same PR, so that the links are correct after the PR is merged? Or should I wait and do this after the release? Or do all of the docs changes go in a separate PR that targets gh-pages? I can't remember how this works â˜šī¸

becky-gilbert avatar Jun 27 '25 20:06 becky-gilbert

The version numbers will auto-update in the docs when the docs are built and released 🚀

jodeleeuw avatar Jun 27 '25 20:06 jodeleeuw

The version numbers will auto-update in the docs when the docs are built and released 🚀

Woo!!

I think this is ready for review. The only caveat is that we might want to add the new minified version survey.css file to the dist archive in the config package. I think that the config update would have to go through before this is package is released. Or if that's an issue, we can leave survey.min.css out of the dist archive for now.

I also switched to survey.min.css in the unpkg links, but I don't think there's any additional config changes needed for that file to show up on unpkg right?

The PR for changes to the config package to add the survey.min.css file to the dist archive is here: #3561

becky-gilbert avatar Jun 27 '25 21:06 becky-gilbert

Sorry to ask but is there a rough ETA to get this merged assuming there are no issues? (to give a timeline to my students)

DominiqueMakowski avatar Jul 01 '25 12:07 DominiqueMakowski

Sorry to ask but is there a rough ETA to get this merged assuming there are no issues? (to give a timeline to my students)

Tagging @jspsych/core as I think I need at least one approving review to merge.

becky-gilbert avatar Jul 01 '25 22:07 becky-gilbert

@DominiqueMakowski this should be released now. Thanks for the nudge 😁

jodeleeuw avatar Jul 08 '25 13:07 jodeleeuw

Thanks a ton @jodeleeuw 🙏 really appreciated 👌

DominiqueMakowski avatar Jul 08 '25 14:07 DominiqueMakowski

Thanks @jodeleeuw!

@DominiqueMakowski I'd love to hear how this version is working for you. Please write up any issues. I was planning on adding markdown support to this plugin in the near future, so if you notice any issues then I can fix them at the same time.

becky-gilbert avatar Jul 08 '25 16:07 becky-gilbert