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

Bug: CoreTable doesn't return most data for fields #282

Closed
aurooba opened this issue Sep 14, 2024 · 12 comments · Fixed by #293
Closed

Bug: CoreTable doesn't return most data for fields #282

aurooba opened this issue Sep 14, 2024 · 12 comments · Fixed by #293
Labels
needs: reproduction This issue needs to be reproduced independently type: bug Issue that causes incorrect or unexpected behavior

Comments

@aurooba
Copy link
Member

aurooba commented Sep 14, 2024

Most of the data for CoreTable returns null. The only meaningful data is returned in the renderedHtml field, which is not ideal.

Here's the query I used:

{
  pages {
    nodes {
      title
      editorBlocks(flat: false) {
        name
        clientId
        parentClientId
        ... on CoreTable {
          anchor
          apiVersion
          attributes {
            textColor
            style
            metadata
            lock
            head {
              cells {
                align
                colspan
                content
                rowspan
                tag
                scope
              }
            }
            hasFixedLayout
            gradient
            foot {
              cells {
                align
                colspan
                content
                rowspan
                scope
                tag
              }
            }
            fontSize
            fontFamily
            className
            caption
            borderColor
            body {
              cells {
                align
                colspan
                content
                rowspan
                scope
                tag
              }
            }
            backgroundColor
            anchor
            align
          }
          renderedHtml
        }
      }
    }
  }
}
@justlevine
Copy link
Contributor

Related #242

@josephfusco josephfusco added needs: reproduction This issue needs to be reproduced independently type: bug Issue that causes incorrect or unexpected behavior labels Sep 16, 2024
@jasonbahl
Copy link
Contributor

@aurooba was this working at one point and then stopped after an update to this plugin or WordPress core? Or was it a feature that has never worked to your knowledge?

@aurooba
Copy link
Member Author

aurooba commented Sep 19, 2024

@jasonbahl I didn't try to implement core/table until 5 days ago, so I'm not sure if it was working before, unfortunately. But happy to go and test it against a previous version of WordPress. I'll test shortly here.

@jasonbahl
Copy link
Contributor

Ok, thanks. Just trying to get an understanding of whether this is a regression or a feature that has never worked. On quick scan of the codebase, it seems to me that this has likely never worked, but I could be mistaken.

@jasonbahl
Copy link
Contributor

jasonbahl commented Sep 19, 2024

I just tried on WordPress 6.6.2 then downgraded to WordPress 6.4 and then 6.1 and it seems to behave the same on all versions.

Fields such as align on the cells always return null on all versions. 🤔

@aurooba
Copy link
Member Author

aurooba commented Sep 19, 2024

@jasonbahl I tested it on 6.5.5 and 6.4, and got the same result, so I suspect you're right and this hasn't worked ever!

@justlevine
Copy link
Contributor

Fields such as align on the cells always return null on all versions. 🤔

For me align isnt returning null, each cell returns the table align 🫣

image

@jasonbahl
Copy link
Contributor

@justlevine interesting. possibly a difference in the data input.

For me, I don't have align set on the table itself, just the <th> so I'm getting null instead of the value of the data-align on the <th>, which is what I would expect given that the head.cells.align should be sourced from td,th data-align (see: https://github.com/WordPress/WordPress/blob/master/wp-includes/blocks/table/block.json#L48)

Regardless, definitely getting incorrect behavior

@justlevine
Copy link
Contributor

Yeah, it's seems to be a combination of using renderedHtml instead of a hydrated innerHtml and some issues with the parsing logic.

@justlevine
Copy link
Contributor

justlevine commented Sep 23, 2024

@justlevine
Copy link
Contributor

@aurooba #293 should fix this for ya 🤞 (I still need to fix the backcompat on WP6.1)

@aurooba
Copy link
Member Author

aurooba commented Sep 26, 2024

Thanks @justlevine I'm looking forward to testing it out! :D But super glad to see this getting closed and fix merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: reproduction This issue needs to be reproduced independently type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants