Skip to content

Update SurveyJS version #3554

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

Merged
merged 20 commits into from
Jul 8, 2025
Merged

Update SurveyJS version #3554

merged 20 commits into from
Jul 8, 2025

Conversation

becky-gilbert
Copy link
Collaborator

@becky-gilbert becky-gilbert commented Jun 13, 2025

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

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).
Edit: after reviewing the release notes, I think that a major release is the safer bet because of possible breaking changes for plugin users.

Copy link

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: 2bdc6b8

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

@DominiqueMakowski
Copy link

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

@becky-gilbert
Copy link
Collaborator Author

@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!

@DominiqueMakowski
Copy link

calling super-@Max-Lovell maybehe has an idea

Do you have a minimal example to reproduce the issue?

@becky-gilbert
Copy link
Collaborator Author

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
Copy link
Collaborator Author

becky-gilbert commented Jun 27, 2025

@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 ☹️

@jodeleeuw
Copy link
Member

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

@becky-gilbert
Copy link
Collaborator Author

becky-gilbert commented Jun 27, 2025

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 becky-gilbert marked this pull request as ready for review June 27, 2025 21:08
@DominiqueMakowski
Copy link

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)

@becky-gilbert
Copy link
Collaborator Author

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.

Copy link
Member

@jodeleeuw jodeleeuw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thank you @becky-gilbert !!

@jodeleeuw jodeleeuw merged commit fe143e2 into main Jul 8, 2025
8 checks passed
@jodeleeuw jodeleeuw deleted the update-surveyjs-version branch July 8, 2025 00:53
@github-actions github-actions bot mentioned this pull request Jun 13, 2025
@jodeleeuw
Copy link
Member

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

@DominiqueMakowski
Copy link

Thanks a ton @jodeleeuw 🙏 really appreciated 👌

@becky-gilbert
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the version of SurveyJS in the survey plugin (to be able to have slider scales)
4 participants