Skip to content

feat: Add graphql mutations lwc recipe#1062

Open
g-pezanoskicohen wants to merge 7 commits into
trailheadapps:mainfrom
g-pezanoskicohen:gpezcoh/feat/graphqlMutations
Open

feat: Add graphql mutations lwc recipe#1062
g-pezanoskicohen wants to merge 7 commits into
trailheadapps:mainfrom
g-pezanoskicohen:gpezcoh/feat/graphqlMutations

Conversation

@g-pezanoskicohen

@g-pezanoskicohen g-pezanoskicohen commented Oct 31, 2025

Copy link
Copy Markdown

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

image

@g-pezanoskicohen g-pezanoskicohen requested a review from a team as a code owner October 31, 2025 17:57
@salesforce-cla

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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">

Copy link
Copy Markdown
Contributor

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?

Comment on lines +112 to +113
const queryRaw = this.buildQuery(params);
const query = gql`${queryRaw}`;

Copy link
Copy Markdown
Contributor

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;

Copy link
Copy Markdown
Contributor

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

Comment on lines +164 to +171
let queryBlock = ` query${index}: ContactUpdate(input: {
Contact: {
FirstName: $FirstName${index}
LastName: $LastName${index}
Phone: $Phone${index}
Title: $Title${index}
Email: $Email${index}
}

Copy link
Copy Markdown
Contributor

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

@g-pezanoskicohen g-pezanoskicohen force-pushed the gpezcoh/feat/graphqlMutations branch from e553894 to f0aaa78 Compare March 12, 2026 17:46
@muenzpraeger

Copy link
Copy Markdown
Contributor

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.

@muenzpraeger

Copy link
Copy Markdown
Contributor

FYI @pozil, please either merge or close out. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants