rsnext/examples/cms-wordpress/components
JP Lew f53ee47b73
[cms-wordpress] Nest one-to-one relationships (#15007)
There is a bug in the cms-wordpress example due to a Wordpress plugin dependency. After running `npm install`, then either `npm run dev` or `npm run build`, the following errors appear in the console:

```shell
> cms-wordpress@1.0.0 dev /Users/jplew/Sites/projects/next.js/examples/cms-wordpress
> next

ready - started server on http://localhost:3000
info  - Loaded env from /Users/jplew/Sites/projects/next.js/examples/cms-wordpress/.env.local
event - compiled successfully
event - build page: /
wait  - compiling...
event - build page: /next/dist/pages/_error
event - compiled successfully
[
  {
    message: 'Cannot query field "name" on type "NodeWithAuthorToUserConnectionEdge". Did you mean "node"?',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "firstName" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "lastName" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "avatar" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  }
]
Error: Failed to fetch API
    at fetchAPI (webpack-internal:///./lib/api.js:31:11)
```

The reason for this is `wp-graphql` released version v0.10.0 ten days ago which introduced a number of breaking changes (https://github.com/wp-graphql/wp-graphql/releases/tag/v0.10.0). Specifically, this is the change that breaks the current example:

> - One to One relationships are now nested. For example post.author and post.featuredImage now return an edge/node instead of the node directly.

More info about this change can be found here: https://github.com/wp-graphql/wp-graphql/issues/347#issuecomment-639071772

After my changes, `npm run dev` and `npm run build` succeed without errors.
2020-07-09 10:03:13 +00:00
..
alert.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
avatar.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
categories.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
container.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
cover-image.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
date.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
footer.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
header.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
hero-post.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
intro.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
layout.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
meta.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
more-stories.js [cms-wordpress] Nest one-to-one relationships (#15007) 2020-07-09 10:03:13 +00:00
post-body.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
post-body.module.css [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
post-header.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
post-preview.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
post-title.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
section-separator.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00
tags.js [Examples] Add WordPress Blog (#13194) 2020-06-01 17:17:20 -05:00