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.
| 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.
Should this be pointing at graphqlMutations?
| const queryRaw = this.buildQuery(params); | ||
| const query = gql`${queryRaw}`; |
There was a problem hiding this comment.
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.
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.
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
e553894 to
f0aaa78
Compare
|
Maintenance-sweep note: this is a legitimate, CLA-signed feature contribution (graphql mutations LWC recipe) that's been waiting on review since late 2025. Flagging for a maintainer to review and either merge or provide feedback — it's the strongest open contribution in the queue. |
|
FYI @pozil, please either merge or close out. Thank you! |
What does this PR do?
Adds a recipe showing the use of graphql mutations to inline edit a data table
What issues does this PR fix or reference?
n/a
The PR fulfills these requirements:
[x] Tests for the proposed changes have been added/updated.
[x] Code linting and formatting was performed.
Functionality Before
No datatable present
Functionality After