Custom javascript and css is not executing if the user is accessing prodigy when all tasks are already complete

"global_css": (CWD / "prodigy.css").read_text(),
"javascript": (CWD / "logout.js").read_text(),

Now, if I save and refresh the screen, the javascript and global css are not being applied.

I think we are loading the javascript on component did mount in bundle.js, Is there a way to execute custom javascript and css always?

this breakpoint is not executing on loading prodigy when all tasks are submitted

Hi @kamalakannan_kumar,

Thank you for a detailed report and debugging info. This actually an edge case we haven't bumped into so far and it, of course, it should be the case that custom css/js is loaded at all times while the server is running.
We'll work on it in the next days and will update you as soon as we have the solution out.

Hi @kamalakannan_kumar,

@ines has just released Prodigy 1.18.a0 that includes the fixes to custom JS/CSS loading as well as two new events prodigyload that fires after app is mounted and custom scripts (JS, CSS) are loaded
add prodigysave event that fires on manual save.
It also has window.prodigy.save exposed so you can access the save endpoint for JS.
I believe you've got an email notification but wanted to share here as well in case it's useful for anyone else :slight_smile:

Hi @magdaaniol , ive tried using window.prodigy.save like this (since i dont have types etc - you ship minified bundle basically which i dont fully understand since complementary python code is there anyways)

window.prodigy

.save()

/* // Cannot read properties of undefined (reading 'then')

.then(() => {

  console.log('Saved')

})\*/

How can i “save” and wait for annotations to be actually saved to the database to proceed?

I’ve tried setting up prodigysave listener in hope that it fires on actual confirmation of the save to database but that fails for different reason :confused: here is bug report prodigyscriptloaded does not fire

actually , prodigysave does not fire either , eg with this below: it does not matter if i click save button of the prodigy itself , or click custom html button to which saveData attached :frowning:

document.addEventListener('prodigysave', event => {
  /\*const { answer, task } = event.detail\*/
  console.log('HERE Saved: '/\*, answer\*/)
})

function saveData() {
    console.log('saveData')
    window.prodigy
    .save()
    /\*    // Cannot read properties of undefined (reading 'then')
    .then(() => {
        console.log('Saved')
    })\*/
}

ive added repro here prodigy-bugs/javascript-events at main · wildfluss/prodigy-bugs · GitHub

Hi @ysz,

Thanks for providing the full script (I also went ahead and edited your inline code so that it easier for other users to read)

I can confirm that prodigysave only fires when the keyboard shortcut (ctrl+S, cmd+S) is being used. It should definitely fire on manual button clicking of course and we are preparing a patch to fix it.

As for your custom button that calls windows.prodigy.save, orginally it was meant to be a low-level API that directly triggers the save action without any UI-related logic (like the conditions check or event dispatching). However, there's actually no good reason to have window.prodigy.save bypass all this logic (including event dispatching). We agree that this results in inconsistent behavior and we'll also fix it in the upcoming patch.
Thanks again for the report and we'll ping you here when the patch is out.

Hi @ysz,

Just an update that we have released Prodigy 1.18.4 that addresses the issues you reported:

  1. prodigysave should now fire consistely regardless of the saving method
  2. prodigyscriptload was added for embedded JS as well. Please, note that the value of the URL event detail for embedded JS is inline. See our updated docs for details.
    Thanks again for your report!