Skip to content

Commit b8e2688

Browse files
Fix error with Copy CURL (#1257)
1 parent b596775 commit b8e2688

File tree

1 file changed

+4
-2
lines changed
  • packages/graphql-playground-react/src/components/Playground/TopBar

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
import { share } from '../../../state/sharing/actions'
2323
import { openHistory } from '../../../state/general/actions'
2424
import { getSettings } from '../../../state/workspace/reducers'
25+
import { Session } from '../../../state/sessions/reducers'
2526
import { ISettings } from '../../../types'
2627

2728
export interface Props {
@@ -30,6 +31,7 @@ export interface Props {
3031
fixedEndpoint?: boolean
3132
isPollingSchema: boolean
3233
endpointUnreachable: boolean
34+
session: Session
3335

3436
editEndpoint: (value: string) => void
3537
prettifyQuery: () => void
@@ -111,8 +113,7 @@ class TopBar extends React.Component<Props, {}> {
111113
this.props.openHistory()
112114
}
113115
getCurl = () => {
114-
// no need to rerender the whole time. only on-demand the store is fetched
115-
const session = getSelectedSession(this.context.store.getState())
116+
const session = this.props.session
116117
let variables
117118
try {
118119
variables = JSON.parse(session.variables)
@@ -157,6 +158,7 @@ const mapStateToProps = createStructuredSelector({
157158
isPollingSchema: getIsPollingSchema,
158159
endpointUnreachable: getEndpointUnreachable,
159160
settings: getSettings,
161+
session: getSelectedSession,
160162
})
161163

162164
export default connect(

0 commit comments

Comments
 (0)