Skip to content

Commit 9020483

Browse files
committed
fix tracing. better project key
1 parent 90d7827 commit 9020483

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/graphql-playground/src/components/MiddlewareApp.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export interface Props {
4444
session?: any
4545
env?: any
4646
config?: GraphQLConfig
47+
configPath?: string
4748
}
4849

4950
export interface State {
@@ -295,6 +296,7 @@ class MiddlewareApp extends React.Component<Props, State> {
295296
fixedEndpoints={Boolean(this.state.configString)}
296297
session={this.props.session}
297298
headers={this.state.headers}
299+
configPath={this.props.configPath}
298300
/>
299301
</App>
300302
</OldThemeProvider>

packages/graphql-playground/src/components/Playground.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export interface Props {
6666
canSaveConfig: boolean
6767
fixedEndpoints: boolean
6868
headers?: any
69+
configPath?: string
6970
}
7071

7172
export interface State {
@@ -179,9 +180,9 @@ export class Playground extends React.PureComponent<Props & DocsState, State> {
179180
}
180181

181182
getStorageKey(props: Props = this.props) {
182-
return props.endpoint
183-
// const multi = !props.fixedEndpoints
184-
// return multi ? 'multi' : props.endpoint
183+
// whenever possible, use the configPath as is more precise.
184+
// localhost:4000 could be used by multiple endpoints
185+
return props.configPath || props.endpoint
185186
}
186187

187188
componentWillMount() {

packages/graphql-playground/src/components/Playground/GraphQLEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,9 @@ export class GraphQLEditor extends React.PureComponent<
902902
if (queryID === this.editorQueryID) {
903903
let extensions
904904
if (result.extensions) {
905-
extensions = result.extensions
905+
extensions = { ...result.extensions }
906906
if (this.props.shouldHideTracingResponse) {
907-
delete result.extensions.tracing
907+
delete result.extensions
908908
}
909909
}
910910
let isSubscription = false

0 commit comments

Comments
 (0)