graphql / graphql/graphiql

[graphiql] Execute multiple operation simultaneously

Open
#2,909 3 comments 1 reaction 0 assignees View on GitHub
enhancement graphiql
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I have a GraphQL subscription running, i.e.
```gql
subscription {
valueXStateChange
}
```
When I run the subscription, I am getting updates in the results window. However, when I subsequently run a query, the `ExecutionContextProvider` https://github.com/graphql/graphiql/blob/a1439db5f2867718d2fa73c3ff198539f3a54fa0/packages/graphiql-react/src/execution.tsx#L102-L106 stops the running subscription. Is this the expected behavior?

If so, then should it behave this way if the subscription is running in one tab and the query is executed in another tab?

### Expected Behavior

I was expecting the results window to update whenever a subscription notification occurred, regardless of whether the user has previously run a query. If this is the expected behavior, I would expect a tab where subscription notifications are being displayed would continue to update if a query were executed on another tab.

### Steps To Reproduce

```Markdown
1. Get a subscription running.
2. Generate data changes, causing the results window to display each subscription notification (Next)
2. Execute a query.
3. Generate another data change and observe the results window does not display the subscription notification, even though the subscription's `next` function is called.
```

### Module pattern

- [ ] graphiql-umd
- [ ] graphiql-esm
- [ ] graphiql-commonjs

### Environment

```Markdown
- GraphiQL Version: 2.0.13
- OS: Windows 10
- Browser: chrome
- Bundler:
- `react` Version: 18.2.0
- `graphql` Version: 16.6.0
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.