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

Error when creating a new Music Lab level #56522

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

sanchitmalhotra126
Copy link
Contributor

Fixes an issue with creating new Music Lab levels in levelbuilder. When creating a level from scratch, the validations editor was throwing an error since there were no existing validations. Adds some defaults to prevent this.

Links

https://codedotorg.atlassian.net/browse/LABS-502

Testing story

Tested locally; was able to create and edit a new Music Lab level

@sanchitmalhotra126 sanchitmalhotra126 requested review from breville and a team February 12, 2024 19:40
@@ -5,4 +5,4 @@

- content_for :body_scripts do
%script{src: webpack_asset_path('js/levels/editors/fields/_validations.js'),
data: {validations: @level.level_data["validations"].to_json, levelname: @level.name, appname: @level.game&.app}}
data: {validations: (@level.properties.dig('level_data', 'validations') || []).to_json, levelname: @level.name, appname: @level.game&.app}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a cool method dig is!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Learned about it from @etaderhold in this PR! #56368

@sanchitmalhotra126 sanchitmalhotra126 merged commit 25506b4 into staging Feb 12, 2024
2 checks passed
@sanchitmalhotra126 sanchitmalhotra126 deleted the sanchit/music-fix-new-level branch February 12, 2024 23:47
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

3 participants