You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer that wants to extend the WPGraphQL IDE with my own extensions, I would like to be able to use state from other parts of the application.
As a maintainer of WPGraphQL IDE I would like to have patterns established for managing state that can be:
tested
repeated
documented
Proposal
I propose that we adopt a standard mechanism for state management.
Some candidates include:
XState
MobX State Tree
WordPress/data (redux)
others?
I would recommend leaning into @wordpress/data and the Redux patterns.
Ideally this will solve the maintenance burden of having an established pattern for handling state and will also solve the problem of giving extension authors a way to "use" state from other parts of the application.
Use Cases
As an extension developer, I would like to be able to "filter" the IDE to add a button to the "GraphiQL Toolbar" that allows me to execute queries as an authenticated user or a public user.
In order to do this, I would need to:
be able to "filter" the toolbar Buttons to add my own Button to render in the toolbar
be able to access the state of the application within my Button to determine things like:
is the IDE in an authenticated state or non-autenticated state?
who is the current user (if authenticated)
set the state to authenticated or public when the button is clicked
This state that the button needs to be aware of is not local to the button, but useful to other components in the application and we need a way to standardize how the state can be used / set from anywhere in the application.
Example
This is a (pseudo) example of a Redux store using @wordpress/data:
As a developer that wants to extend the WPGraphQL IDE with my own extensions, I would like to be able to use state from other parts of the application.
As a maintainer of WPGraphQL IDE I would like to have patterns established for managing state that can be:
Proposal
I propose that we adopt a standard mechanism for state management.
Some candidates include:
I would recommend leaning into
@wordpress/data
and the Redux patterns.Ideally this will solve the maintenance burden of having an established pattern for handling state and will also solve the problem of giving extension authors a way to "use" state from other parts of the application.
Use Cases
As an extension developer, I would like to be able to "filter" the IDE to add a button to the "GraphiQL Toolbar" that allows me to execute queries as an authenticated user or a public user.
In order to do this, I would need to:
This state that the button needs to be aware of is not local to the button, but useful to other components in the application and we need a way to standardize how the state can be used / set from anywhere in the application.
Example
This is a (pseudo) example of a Redux store using
@wordpress/data
:Then to use this we could do something like:
Get the current user
Set the current user
The text was updated successfully, but these errors were encountered: