ashhitch / wp-graphql-yoast-seo

This is an extension to the WPGraphQL plugin for Yoast SEO
GNU General Public License v3.0
222 stars 49 forks source link

Fix TwitterImage: Cannot return null for non-nullable field \"MediaItem.databaseId\"." #156

Closed kuuak closed 1 year ago

kuuak commented 1 year ago

When no twitter image set, the resolver returned an empty string. This is not consistent with othe MediaItem fields, and make any non-nullable field in the MediaItem type throw an error.

Capture d’écran 2023-04-28 à 10 04 04

As you can see on the screenshots below, for opengraphImage field return null instead of an object with properties with empty string.

opengraphImage returns null twitterImage returns an object with empty string properties
Capture d’écran 2023-04-28 à 10 05 30 Capture d’écran 2023-04-28 à 10 04 23

This pull request fixes this and simply if not twitter image set, the property twitterImage will be null.

=> after the fix

Capture d’écran 2023-04-28 à 10 14 32

ashhitch commented 1 year ago

@kuuak thanks for this will get it merged in