-
Notifications
You must be signed in to change notification settings - Fork 96
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 Make graphql mutation template abstractions work #1498
FIX Make graphql mutation template abstractions work #1498
Conversation
The input parameters must be lowercase.
@@ -76,3 +76,15 @@ export const getFragments = ({ availableFragments, fragments = [] }) => ( | |||
: capturedFragments | |||
), '') | |||
); | |||
|
|||
function isLegacy() { | |||
return !!document.body.getAttribute('data-graphql-legacy'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See
const isLegacy = !!document.body.getAttribute('data-graphql-legacy'); |
6bcf55c
to
171f652
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test locally. Didn't see any problem.
LGFM.
Small question, why did you update only buildUpdateMutation.js
and buildCreateMutation.js
, but didn't change buildDeleteMutation.js
buildReadMutation.js
etc.?
I didn't change the others for a couple of reasons:
At some point it is likely that at least the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests have been done in local environment with GQ3 and GQ4. All passed. Approve.
The input parameters must be lowercase.
This has been required since https://github.com/silverstripe/silverstripe-admin/pull/1148/files#diff-c95be282611b632f7ce8c94d0f00c1c6768dc56b746f43e6bb066d076b5eeb9bR29-R32 which forces lowerCamelCase for field names for graphql v3 in the admin schema.
See also for example the equivalent asset-admin PR where all of the field names in queries/mutations are changed to lowerCamelCase because now they have to be.
I've checked and double checked that these aren't used anywhere in our code (which explains why they were never updated to be lowerCamelCase) but I'll run a CI with asset-admin and campaign-admin with this PR just in case.
Why these changes are required
Without changing
Input
toinput
we get the following error in with both graphql versions:Without dynamically setting the correct input argument types, in graphql 4 we get this error:
NOTE
This change was reverted once: #1488
The change being made in this new PR is a lot less invasive, and is only the changes that are absolutely necessary to get the docs working.
I've checked for anywhere that's using these abstractions, and can't find any that will be affected by the changes I've made here - but make sure to check react sections of the CMS to be sure they're working as expected, and if you're aware of any react-heavy modules, maybe test those with this PR as well.
Installer CI run
There are some behat failures related to toast messages - these will be resolved with silverstripe/silverstripe-asset-admin#1345
Issue