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 workspaceName prop #772

Merged
merged 7 commits into from
Aug 1, 2018
Merged

Add workspaceName prop #772

merged 7 commits into from
Aug 1, 2018

Conversation

BrunoScheufler
Copy link
Contributor

@BrunoScheufler BrunoScheufler commented Jul 10, 2018

Fixes #771

Changes proposed in this pull request:

  • Add workspaceName prop to be passed down to Playground component if activeProjectName is not set
  • Add mapPropsToState to change the PlaygroundWrapper state upon prop changes

@BrunoScheufler
Copy link
Contributor Author

BrunoScheufler commented Jul 23, 2018

Before merging, please test if this solution works as I could not fully test the changes.

The desired outcome would be a PlaygroundWrapper component which reacts to specific prop changes.

To test it, one might create a component which passes changing endpoint props down to the PlaygroundWrapper/MiddlewareApp.

@@ -379,7 +387,9 @@ class PlaygroundWrapper extends React.Component<
fixedEndpoints={Boolean(this.state.configString)}
headers={this.state.headers}
configPath={this.props.configPath}
workspaceName={this.state.activeProjectName}
workspaceName={
this.state.activeProjectName || this.props.workspaceName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to the other way around - this.props.workspaceName || ... as otherwise it's not possible to overwrite the workspaceName when using a graphql config

@timsuchanek timsuchanek merged commit 7d7969f into graphql:master Aug 1, 2018
cgxxv pushed a commit to cgxxv/graphql-playground that referenced this pull request Mar 25, 2022
* Fix announcement link

* fix: add workspaceName prop to PlaygroundWrapper with passthrough to Playground

* fix: Added mapPropsToState to react to prop changes

* fix: remove unnecessary check

* fix: swapped orders of workspaceName and activeProjectName
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

Successfully merging this pull request may close these issues.

2 participants