-
Notifications
You must be signed in to change notification settings - Fork 6
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
WPGraphQL attributes missing with core/table array attributes #53
Comments
Just wanted to note here that we're having the same issue in our attempt to use this API at @sfstandard. It's a blocker for our use case. |
@james-tyner We'll look at getting a fix for table |
@alecgeatches great! I just want to be clear that this issue doesn't affect only tables -- it's any block with data in an array format. In our case, we're seeing issues with blocks on our homepage that come from https://github.com/alleyinteractive/wp-curate |
Thank you for the additional information, @james-tyner. If possible, could you provide the specific block you're having trouble with from the WP Curate plugin, or even a whole reproduction like the issue content above? Just want to make sure that our solution adequately covers your case. Thank you! |
I made an initial PR to solve the issue here: Fix "Array" values in GraphQL block array data #61. @james-tyner would JSON representation of array values work for your use-case? Thank you! |
So fast! I'll pull in @Zamfi99 here who can take a look at the fix and our implementation |
WPGraphQL results for table attributes with array values have
Array
strings and are missing children.Reproduction
Create a post containing a table, e.g.
Using the created post's ID, query for
blocks
/innerBlocks
data:See "Array" in results:
Note that the
head
,body
, andfoot
attributes all have a value of"Array"
, rather than an actual array. It's not possible to reconstruct the table.Expected results
The REST API returns array values as expected:
Fixing it
At the time of writing, WPGraphQL
BlockAttribute
is defined as a{ name: String, value: String }
combination:Possible fixes could be to make the value support multiple types (
String|Array
) if that's possible in GraphQL, or we could continue to use theString
type and put complex data types as JSON, e.g.The text was updated successfully, but these errors were encountered: