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 crash when Administrator has custom field that is internal but not readonly #3159

Merged

Conversation

toBeOfUse
Copy link
Contributor

Description

This fixes #3158.

Previously, the addActiveAdministratorCustomFields function, which adds the custom fields for the Administrator entity into the input type for the updateActiveAdministrator mutation, would assume that the UpdateAdministratorCustomFieldsInput type exists if there are any non-readonly custom fields, even if those custom fields are internal. This was incorrect, since internal custom fields will not appear in mutation input types, any more than ones that are readonly. So, the schema produced would reference that input type, causing a crash if it did not exist, which happened every time there were internal, non-readonly custom fields.

I also added a test to confirm that the UpdateAdministratorCustomFieldsInput type is not referenced when the Administrator entity has only an internal custom field.

Also, an irrelevant typo is fixed.

Breaking changes

Does this PR include any breaking changes we should be aware of?

Nope.

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

Copy link

vercel bot commented Oct 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Oct 22, 2024 0:45am

@michaelbromley michaelbromley merged commit e03b7f0 into vendure-ecommerce:master Oct 31, 2024
28 of 29 checks passed
@michaelbromley
Copy link
Member

Thanks for this contribution. Everything is perfect - a very good, detailed issue which was easy for me to reproduce, a PR which includes tests, & a concise PR summary. Very well done 🙌

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
@toBeOfUse toBeOfUse deleted the fix/administrator-internal branch November 4, 2024 01:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specifying internal Administrator custom field without also specifying readonly causes crash
2 participants