-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix to player component scoreScreenURL handling #1559
Fix to player component scoreScreenURL handling #1559
Conversation
…navigates to an updated score url, if provided one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reproduced the issue using setTimeout(() => { setScoreScreenURL(result.score_url) }, 5000)
. This seems to have fixed it. Only potential, and similar, issue I see being is setQueueProcessing(true)
taking too long, and either nothing happens or duplicate play_log_save
calls are made, but as I couldn't actually cause this to happen without using setTimeout
, I don't think it's something to worry about.
…screen url useRef hook
In my rush to engineer this fix yesterday, I completely overlooked |
…ot found in session
…ng to contexts with missing tokens
…sion-token-triage Missing session token triage
Closing this and re-opening as a more comprehensive set of fixes associated with the passback bug. |
Resolves #1558. This is a high priority issue.
The
widget-player
component assigns a default value to thescoreScreenURL
state object, but if played in an LTI context, theon_play_completed_event
returns ascore_url
value that's appended to the response object ofplay_logs_save
if the score module reports the play is completed.The problem is that the
scoreScreenURL
state object is updated independently of the rest of the component's state values that manage the overall player state. As best I can tell, under certain circumstances, thescoreScreenURL
is not updated before theplayState
state value, and the hook responsible for navigating to the score screen fires with the oldscoreScreenURL
value instead. Because of the nature of the race condition, this is very difficult to test.This PR:
Defers thequeueProcessing
flag from being reset tofalse
if thescore_url
value is present in the response until after thescoreScreenURL
is properly updated (via anotheruseEffect
hook). ThequeueProcessing
flag must be false before theplayState
is updated toend
, which is one of the trigger conditions for navigating to the score screenReplaces the
scoreScreenURL
state object with auseRef
hook, which is updated immediately and maintained across renders.