Pavlovia Sync Suddenly Deletes Core PsychoJS Variables

Hi everyone,

I’ve been developing an experiment for a while, and suddenly I encountered a strange issue. When I sync my project with Pavlovia, it starts deleting the creation of core PsychoJS variables from the JS code.

Even if I manually add them back, the next sync removes them again.
Here’s a screenshot comparing the commits to show what’s happening:

Has anyone encountered this before? Any idea why this might be happening or how to prevent it?

Thanks in advance for your help!n.

What error do you get if you don’t edit the JS code?

I got the error:

What version of PsychoPy are you using?

2024.2.4

Thanks.

Is your “use version” in Experiment Settings blank? Do you have any loops? Do you have any code referring to currentLoop?

The use version is not blank, but contains 2024.2.0, I got multiple loops in the experiments but no code referring to currentLoop

Try making it blank.

Done, nothing changed

Did you check an incognito tab?

Yes

Okay. Please could you add me (Wake) as a developer and I’ll take a look.

However, first please set it to inactive and then piloting/running again.

Hey I added you, thanks

Hi.

I’ve taken a look and I’m pretty sure that the issue is that you are writing JavaScript code that isn’t compatible with PsychoJS. You have disabled your text components and replaced them with JS only code components. You implied that previous versions of the experiment worked fine. On what date did this experiment last run and what did you add next?

Begin Routine

let introDiv = document.getElementById("introTextDiv");
introDiv.innerHTML = introText;
introDiv.style.display = "block";

End Routine

// Hide intro text at end of trial
let introDiv = document.getElementById("introTextDiv");
if (introDiv) {
    introDiv.style.display = "none";
}

Here are some threads with the same issue:

and relevant tips

Thanks! found the problem:

This row isn’t compatible with PsychoJS:

slider_value = document.querySelector('input[name="expectation"]:checked')?.value;

Instead, I changed it to:

let selectedInput = document.querySelector('input[name="expectation"]:checked');
let slider_value = selectedInput ? selectedInput.value : null;