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

Cannot query field "align" on type "CoreQuoteAttributes" #1932

Open
1 task done
ttstauss opened this issue Aug 15, 2024 · 6 comments · May be fixed by #1946
Open
1 task done

Cannot query field "align" on type "CoreQuoteAttributes" #1932

ttstauss opened this issue Aug 15, 2024 · 6 comments · May be fixed by #1946
Assignees
Labels
package: @faustwp/blocks Related to the Faust blocks package type: bug Issue that causes incorrect or unexpected behavior

Comments

@ttstauss
Copy link

Description

I'm getting the following error:

error - GraphQL errors: [
 {
   message: 'Cannot query field "align" on type "CoreQuoteAttributes".',
   extensions: { category: 'graphql' },
   locations: [ [Object] ]
 }
]

This goes away when I remove @faustwp/blocks from my project.

This appears to be the issue: WordPress/gutenberg@9a80ddd

Steps to reproduce

  1. Update WordPress and packages to versions indicated below.
  2. Ensure @faustwp/blocks is set up and used in the project.
  3. Try to run dev or a build and get the error.

Additional context

No response

@faustwp/core Version

3.0.3

@faustwp/cli Version

3.0.2

FaustWP Plugin Version

1.3.2

WordPress Version

6.6.1

Additional environment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes
@theodesp theodesp added the needs: reproduction This issue needs to be reproduced independently label Aug 16, 2024
@theodesp
Copy link
Member

Hey @ttstauss thanks for the report. I will try to reproduce but if that is the case we will have to create a new major version of blocks package since they changed the schema. In the meatime you can still provide your own implementation of CoreQuote by overriding the blocks export key 'CoreQuote' here:

https://github.com/wpengine/faustjs/blob/canary/examples/next/block-support/wp-blocks/index.js#L9

@jasonbahl
Copy link
Collaborator

@ttstauss I ran into this and was able to fix it with the following:

my wp-blocks/index.js looks like this:

import { CoreBlocks } from '@faustwp/blocks'

import { CoreQuote } from './CoreQuote'

const blocks = {
  ...CoreBlocks,
  CoreQuote,
}

export default blocks

Then my CoreQuote block file looks like this:

file: wp-blocks/CoreQuote.js

import { CoreBlocks } from "@faustwp/blocks";
import {gql} from "@apollo/client";
const { CoreQuote: FaustCoreQuote } = CoreBlocks;

export function CoreQuote(props) {
  return <FaustCoreQuote {...props} />;
}

CoreQuote.displayName = { ...FaustCoreQuote.displayName };
CoreQuote.config = {
    ...FaustCoreQuote.config,
    name: `CustomCoreQuoteFragment`
};
CoreQuote.fragments = {
    key: `CustomCoreQuoteFragment`,
    entry: gql`
    fragment CustomCoreQuoteFragment on CoreQuote {
      attributes {
        textAlign
        anchor
        backgroundColor
        citation
        className
        fontFamily
        fontSize
        gradient
        lock
        style
        textColor
        value
        cssClassName
      }
    }
    `
};

@jasonbahl
Copy link
Collaborator

fwiw, this was caused by a change in core WordPress where an attribute on the block was changed. . .so technically this is a breaking change to WordPress core that was just surfaced by the mapping of blocks to the schema.

@ttstauss
Copy link
Author

@theodesp and @jasonbahl, this pointed me in the right direction for a fix. Thanks!

@emaxees
Copy link

emaxees commented Aug 23, 2024

Hi, how are you? I'm encountering the same issue, so I followed the steps that jasonbahl mentioned to fix this. It seems to have worked, but now I'm facing another problem and I'm not sure if it's related to that.
I'm running Wordpress 6.6.1. Thank you in advance.
Screenshot 2024-08-23 at 5 02 44 PM

@jasonbahl
Copy link
Collaborator

@emaxees this appears to be unrelated. It looks like you have a query defined in a template with variable $databaseId but are not providing the variable to the query.

Check your wp-templates to see if you are indeed passing variables correctly.

Here's an example of a wp-template that defines a query that uses a variable:

And passes the variable to the query:

@jasonbahl jasonbahl added type: bug Issue that causes incorrect or unexpected behavior package: @faustwp/blocks Related to the Faust blocks package and removed needs: reproduction This issue needs to be reproduced independently labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: @faustwp/blocks Related to the Faust blocks package type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants