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

Add contextIdentifier: UUID? parameter to perform(mutation:...) method on ApolloClient #2514

Closed
marsn-ext opened this issue Sep 26, 2022 · 5 comments
Labels
help wanted Issues the Apollo team would love help from the community about networking-stack

Comments

@marsn-ext
Copy link

Hello!

Feature request

I'd like to add an optional parameter on ApolloClient's perform(mutation:...) method for the contextIdentiifer: UUID? of the request. This parameter is already present in the client's fetch(query:...) method, but unfortunately missing from perform(mutation:...).

Motivation

I'm interested in a similar functionality described by this other issue #2283. In short, I need to add certain headers to specific request instances. Using the contextIdentifier helps with this, but this option is not available on mutations.

In the short term, adding the parameter should offer this flexibility for mutations while the H2 networking stack overhaul comes through (as mentioned in the other issue).

Proposed solution

Add optional contextIdentifier: UUID? to ApolloClient's perform(mutation:...) method.

Outstanding Questions

The only potential conflict this PR could add is if integrators have created their own implementation against ApolloClientProtocol. In those cases, they will have to repair the conformance since the change is a breaking change on the protocol.

@marsn-ext
Copy link
Author

I'm happy to draft up a PR for this if this change proposal sounds reasonable 👍

@calvincestari
Copy link
Member

Hi @marsn-ext, apologies for taking so long to get back to you. At first glance I'm not opposed to adding contextIdentifier to the perform(mutation: .. ) protocol signature. It seems you're aware of the networking stack being the next target for development so if this provides short-term gain without severe downsides I'm fine with it.

@AnthonyMDev - do you have any objection to this addition?

@bignimbus bignimbus added networking-stack help wanted Issues the Apollo team would love help from the community about labels Feb 10, 2023
@vincentisambart
Copy link
Contributor

It seems this can be closed as the parameter has been added to 1.9.1:

Feature/ContextIdentifier for the mutate queries (apollographql/apollo-ios-dev#281): Mutation operations can now be given a context identifier to be used later in the request.

@calvincestari
Copy link
Member

Thanks @vincentisambart, I'd long forgotten that we had an issue for that PR change.

Copy link
Contributor

github-actions bot commented Mar 5, 2024

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues the Apollo team would love help from the community about networking-stack
Projects
None yet
Development

No branches or pull requests

4 participants