-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Add graphql mutations lwc recipe #1062
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
base: main
Are you sure you want to change the base?
feat: Add graphql mutations lwc recipe #1062
Conversation
|
Thanks for the contribution! It looks like @g-pezanoskicohen is an internal user so signing the CLA is not required. However, we need to confirm this. |
| </template> | ||
| </div> | ||
| <c-view-source source="lwc/datatableInlineEditWithUiApi" slot="footer"> | ||
| Mutate data in a table with inline editing using graphQl |
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.
| Mutate data in a table with inline editing using graphQl | |
| Mutate data in a table with inline editing using GraphQL Mutations |
| <c-error-panel errors={errors}></c-error-panel> | ||
| </template> | ||
| </div> | ||
| <c-view-source source="lwc/datatableInlineEditWithUiApi" slot="footer"> |
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.
Should this be pointing at graphqlMutations?
| const queryRaw = this.buildQuery(params); | ||
| const query = gql`${queryRaw}`; |
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.
I think you may as well just push the gql usage into buildQuery - Not much value to waiting to parse until we're back here
| const { errors, data, refresh } = result; | ||
| // We hold a reference to the refresh function on the graphQL query result so we can call it later. | ||
| if (refresh) { | ||
| this.refreshGraphQL = refresh; |
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.
You might be able to omit the refreshGraphQL call - Double check if the extensions are properly returning the weakEtag and id of each Record, as we expect
| let queryBlock = ` query${index}: ContactUpdate(input: { | ||
| Contact: { | ||
| FirstName: $FirstName${index} | ||
| LastName: $LastName${index} | ||
| Phone: $Phone${index} | ||
| Title: $Title${index} | ||
| Email: $Email${index} | ||
| } |
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.
I would recommend building this input block as JSON in a variable value instead, I think you could clean up many of the aliases that way
What does this PR do?
What issues does this PR fix or reference?
#
The PR fulfills these requirements:
[ ] Tests for the proposed changes have been added/updated.
[ ] Code linting and formatting was performed.
Functionality Before
<insert gif and/or summary>
Functionality After
<insert gif and/or summary>