Skip to content
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

adapt-contrib-languagePicker: triggers error if _restoreStateOnLanguageChange enabled #2905

Closed
moloko opened this issue Sep 7, 2020 · 6 comments

Comments

@moloko
Copy link
Contributor

moloko commented Sep 7, 2020

If you have a multilanguage course and are using the option _restoreStateOnLanguageChange, when you switch language you either get an error (v5.6.1) - or no error but you end up on the wrong page (v5.7.0)

In Adapt v5.6.1, this is the error that's being triggered:
image

In v5.7.0, (using the OOTB content) if you change language from the menu, question components or assessment pages, you end up being sent back to the presentation components page - which is presumably why the above error is being triggered: because languagePickerModel expects 'menuView:ready' to be triggered, but it never is - 'pageView:ready' gets triggered instead.

@moloko
Copy link
Contributor Author

moloko commented Sep 7, 2020

To fix the v5.6.1 error it looks like this line in languagePickerModel needs to be changed to:

if (!Adapt.findById(this.locationId)) return;

@oliverfoster
Copy link
Member

Can change the event listener to contentObjectView:ready in v5.7+

@moloko
Copy link
Contributor Author

moloko commented Sep 7, 2020

Can change the event listener to contentObjectView:ready in v5.7+

I'm not sure it's the event that's the problem, it's more why is it trying to send you to the course's first page?

@moloko
Copy link
Contributor Author

moloko commented Sep 7, 2020

For example, in v5.7.0 if i disable the setting _restoreStateOnLanguageChange and then change languages I get sent back to presentation components instead of the menu, changing the event listener wouldn't help with that

@moloko
Copy link
Contributor Author

moloko commented Sep 7, 2020

I think it's something to do with the _start configuration. even though it's not enabled in the JSON it somehow seems to be getting enabled if I change languages.

@moloko moloko changed the title adapt-contrib-languagePicker: has problems with FW v5.6.1 and FW v5.7.0 adapt-contrib-languagePicker: triggers error if _restoreStateOnLanguageChange enabled Sep 9, 2020
@moloko
Copy link
Contributor Author

moloko commented Sep 9, 2020

In v5.7.0, (using the OOTB content) if you change language from the menu, question components or assessment pages, you end up being sent back to the presentation components page - which is presumably why the above error is being triggered: because languagePickerModel expects 'menuView:ready' to be triggered, but it never is - 'pageView:ready' gets triggered instead.

This is a different issue altogether which has only surfaced in v5.7.0 because of this change. It's still possible to replicate this in earlier v5.x releases

Have moved this over to #2907

@moloko moloko closed this as completed Oct 28, 2020
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

No branches or pull requests

2 participants