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

feat: add WPGraphQL IDE as an "Experiment" #3144

Closed

Conversation

jasonbahl
Copy link
Collaborator

This uses the beta "Experiments API" to register the new WPGraphQL IDE as an "Experiment"

WIP

  • note: the actual raw JS files are not in here, just the built IDE files. We could maintain the JS in here or an external repo that then publishes the build files here or whatever 🤷🏻

@jasonbahl jasonbahl self-assigned this May 30, 2024
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 134975 lines exceeds the maximum allowed for the inline comments feature.

@coveralls
Copy link

coveralls commented May 30, 2024

Coverage Status

coverage: 81.978% (-2.3%) from 84.29%
when pulling 9681ade on jasonbahl:feat/experiment/wpgraphql-ide
into 30ee148 on wp-graphql:develop.

Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Only implementation suggestion (until we add more Admin-related stuff in the API) is to colocate Ide in Experimental\Experiment\WPGraphQLIDE.

This would theoretically allow us to split up that 600-line class, but more importantly it makes it easy at a glance to determine what code is related to an experiment vs what code is mainlined into core.

if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( 'toplevel_page_graphiql-ide' === $screen->id ) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return;
if ( null !== $screen && 'toplevel_page_graphiql-ide' === $screen->id ) {
return;

* @return mixed The modified value of the field.
*/
public function ensure_graphiql_link_is_unchecked( $value, $default_value, string $option_name, array $section_fields, string $section_name ) {
if ( 'show_graphiql_link_in_admin_bar' === $option_name && 'graphql_general_settings' === $section_name ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why $section_fields can be a string, but since we dont need it, easy enough to ignore the type.

Suggested change
if ( 'show_graphiql_link_in_admin_bar' === $option_name && 'graphql_general_settings' === $section_name ) {
public function ensure_graphiql_link_is_unchecked( $value, $default_value, string $option_name, $section_fields, string $section_name ) {

$plugin_data = get_plugin_data( __FILE__ );

return $plugin_data[ $key ] ?? null;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

PHPStan: lets enforce the string return type.

Suggested change
}
return isset( $plugin_data[ $key ] ) ? (string) $plugin_data[ $key ] : null;
}

Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Not sure why $section_fields can be a string, but since we dont need it, easy enough to ignore the type.

	public function ensure_graphiql_link_is_unchecked( $value, $default_value, string $option_name, $section_fields, string $section_name ) {

This suggestion should be on the previous line 🤦

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 151858 lines exceeds the maximum allowed for the inline comments feature.


const { graphqlEndpoint } = window.WPGRAPHQL_IDE_DATA;

const base64Credentials = btoa( `growth:growth` );

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "growth:growth" is used as
authorization header
.
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 31863 lines exceeds the maximum allowed for the inline comments feature.

- remove built files from WPGraphQLIDE experiment (they shouldn't be versioned)
@jasonbahl jasonbahl force-pushed the feat/experiment/wpgraphql-ide branch from 49760fd to 9681ade Compare June 4, 2024 23:10
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 31870 lines exceeds the maximum allowed for the inline comments feature.

Copy link

codeclimate bot commented Jun 4, 2024

Code Climate has analyzed commit 9681ade and detected 49 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 24
Duplication 25

View more on Code Climate.

@jasonbahl
Copy link
Collaborator Author

I'm closing this PR as I don't believe the IDE makes sense as an Experiment.

The IDE is a full product on its own that deserves its own release lifecycle.

The Experiments API is still something we want to add to core WPGraphQL and will benefit features such as:

  • Custom Scalars
  • Refactored "Where" args (i.e. sort/filter arguments on connections)

These features are smaller in scope and are intended to directly relate to core WPGraphQL, but will require some iteration and feedback before being merged to the core codebase. Once merged, there's high likelihood there would be little iteration of these features, where the IDE will likely have continuous iteration long-term.

@jasonbahl jasonbahl closed this Jun 5, 2024
@justlevine
Copy link
Collaborator

Note to future selves:

If a feature is in a very active state of development - defined as "likely requires more frequent public releases than WPGraphQL core's release cadence of ~2-4 weeks" - it would be better served as a separate plugin than an Experiment.

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.

3 participants