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

Fix error that occurs if facilityDatasetExtraFields is null. #12534

Merged

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Aug 2, 2024

Summary

  • Prevents property access on null or undefined for facilityDatasetExtraFields

References

Fixes #12533

Reviewer guidance

Make sure that you can still load the demographic editing in the user editing in the admin UI.


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@@ -41,7 +41,7 @@
},
computed: {
customSchema() {
return this.facilityDatasetExtraFields.demographic_fields || [];
return this.facilityDatasetExtraFields?.demographic_fields || [];
Copy link
Member

Choose a reason for hiding this comment

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

If we allow facilityDatasetExtraFields to be null. Then this prop should not be marked as required right? https://github.com/rtibbles/kolibri/blob/787162af96d4af31dc23ec06d370692524679c42/packages/kolibri-common/components/ExtraDemographics/index.vue#L35

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean, it is required - it's just that VueJS prop validation doesn't actually do anything in production, it's advisory to ensure that developers are using props appropriately. The issue arises because a value is passed in for the prop, but the value is null.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, well that makes sense haha, thanks!

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

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

lgtm!

@radinamatic
Copy link
Member

Tested user creation (all types), user properties editing, user deletion, class assignment, both on the original and one newly created additional facility. All is 🟢 to go! 👏🏽 🚀

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

LGTM too! 💯 👍🏽 :shipit:

@rtibbles rtibbles merged commit dc36695 into learningequality:release-v0.17.x Aug 5, 2024
34 checks passed
@rtibbles rtibbles deleted the extra_demographics branch August 5, 2024 17:58
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.

3 participants