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

Expose the operationName to the url callback #113

Open
johnd-genie opened this issue Dec 12, 2024 · 0 comments
Open

Expose the operationName to the url callback #113

johnd-genie opened this issue Dec 12, 2024 · 0 comments

Comments

@johnd-genie
Copy link

johnd-genie commented Dec 12, 2024

Story

As a user it is helpful to display the operationName in the network panel to easily disambiguate between subscriptions.

If the operationName or full operation is passed to the url callback:

url: string | ((operation: Operation) => Promise<string> | string);

...

export function createClient(options) {
  ...
  return {
        subscribe(request, sink) {    
          ...
          const url = typeof options.url === 'function'
                                ? await options.url(request)
                                : options.url;

Then it is possible to do something like this:

createClient({
 url: ({operationName}) => `graphql-sse/${operationName}`
})

Which results in the Dev tools Network panel looking like this (top 2 with the change vs. bottom 2 without):
image

Would something along these lines be possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant