Hello there!
I’ve recently had an issue raised on my script, and after doing a little bit of digging, I think this could be related to this script.
In summary, the user reported that when using my script with the Back To Back script (which mainly just uses the queue manipulator to set some properties on the queue), they occasionally get this error:
This is kind of hard to debug, I haven’t been able to replicate it so far, but…
I can see that this isn’t directly an error in my script, and, so far, I have found the following in WaniKani’s code:
- The error is on this line:
const stageNames = this.srsIdStageNames.get(srsId) this.srsIdStageNamesis initialised in the constructor asthis.srsIdStageNames = new Map(srsMap.srs_ids_stage_names), so something is going wrong there for it to return undefined.- The
srsMapcomes from the quiz queue controller code, which initialises it assrsMap = JSON.parse(this.subjectIdsWithSRSTarget.innerText), so something must be wrong with thesubjectIdsWithSrs. - It could also be that the
srsIdStageNamesmap does exist, butsrsIdcan’t be found.
All I do in my script is: on a turbo:load event, replace the queue node with one that has updated SRS stage names in subjectIdsWithSRS. So, in my mind, the only thing that could even go wrong is the SRS stage names don’t get updated correctly. I wouldn’t have expected this crash, but I feel like I’m missing something. To be clear, my script does not use the queue manipulator.
The questions that I’m currently pondering on are:
- Is this an error you’ve encountered before?
- Am I missing something, or am doing something I’m not supposed to be doing in my script?
- Could anything in your script be causing this? Or, even just at which point this could be happening (i.e. how it can be replicated)?
- Is the Back To Back script doing something it’s not supposed to be doing with the queue manipulator?
Would you be able to help in answering any of these please? Any help would be really appreciated ![]()
I’ll keep digging into this, and will report back if I find anything else.
