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

JI-5464 return null fields for empty state #92

Merged
merged 2 commits into from
Sep 19, 2023
Merged

JI-5464 return null fields for empty state #92

merged 2 commits into from
Sep 19, 2023

Conversation

devland
Copy link
Contributor

@devland devland commented Sep 19, 2023

This will return null for empty saved states so that the h5p core library will no longer incorrectly show the "Your progress was restored" message.
Without this change the progress restored message is incorrectly shown on h5p.com instances when the user enters no data and refreshes the page.

@otacke
Copy link
Owner

otacke commented Sep 19, 2023

I wish those things were documented somewhere instead of using H5P.com as some form of a hidden de-facto guideline that external contributors are not aware of.

I don't know about the internals of the restart button and what it considers to be a state that should enable the button: Should a state be returned at all if the user has not interacted with the page? Or should the state really contain null properties? Does the button really check all properties for being non-nullish?

I solved it in otacke/h5p-sort-paragraphs@03785a6 by not returning a state at all if the user has not answered the exercise.

@devland
Copy link
Contributor Author

devland commented Sep 19, 2023

Should a state be returned at all if the user has not interacted with the page? Or should the state really contain null properties? Does the button really check all properties for being non-nullish?

The button checks the state by its attributes and it's considered to be empty if they are null or undefined.
false, empty strings or 0 are not considered to be empty attributes.

@otacke
Copy link
Owner

otacke commented Sep 19, 2023

Thanks for letting me know. Your cleaned up version returns undefined instead of some state with "empty" parameters. Nice that way.

@otacke otacke merged commit e3f9573 into otacke:master Sep 19, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants