-
Notifications
You must be signed in to change notification settings - Fork 2
docs(example): Nuxt Data Fetch #207
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
base: main
Are you sure you want to change the base?
Conversation
@alexwpengine I had an issue running the example.
ℹ Error: [GET] "http://127.0.0.1:63028/__nuxt_vite_node__/manifest": 500 Server Error
⁃ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
⁃ at async $fetchRaw2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:311:14)
306 ┃ await callHooks(
307 ┃ context,
308 ┃ context.options.onResponseError
309 ┃ );
310 ┃ }
❯ 311 ┃ return await onError(context);
312 ┃ }
313 ┃ return context.response;
314 ┃ };
315 ┃ const $fetch = async function $fetch2(request, options) {
316 ┃ const r = await $fetchRaw(request, options);
⁃ at async $fetch2 (node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:316:15)
⁃ at async <anonymous> (node_modules/nuxt/dist/core/runtime/nitro/utils/renderer/build-files.js:14:20)
⁃ at async Object.render (node_modules/nuxt/dist/core/runtime/nitro/handlers/renderer.js:69:20)
⁃ at async Object.handler (node_modules/nitropack/dist/runtime/internal/renderer.mjs:25:22)
⁃ (async file://node_modules/h3/dist/index.mjs:2003:19)
⁃ at async Object.callAsync (node_modules/unctx/dist/index.mjs:72:16)
⁃ at async toNodeHandle (node_modules/h3/dist/index.mjs:2295:7)
⁃ at async b (node_modules/node-mock-http/dist/index.mjs:1:6808)
[CAUSE]
FetchError {
stack: '[GET] "http://127.0.0.1:63028/__nuxt_vite_node__/manifest": 500 Server Error\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
'at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:311:14)\n' +
'at async $fetch2 (./node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:316:15)\n' +
'at async <anonymous> (./node_modules/nuxt/dist/core/runtime/nitro/utils/renderer/build-files.js:14:20)\n' +
'at async Object.render (./node_modules/nuxt/dist/core/runtime/nitro/handlers/renderer.js:69:20)\n' +
'at async Object.handler (./node_modules/nitropack/dist/runtime/'... 617 more characters,
message: '[GET] "http://127.0.0.1:63028/__nuxt_vite_node__/manifest": 500
Server Error',
name: 'FetchError',
request: [Getter]
options: [Getter]
response: [Getter]
data: [Getter]
status: [Getter]
statusCode: [Getter]
statusText: [Getter]
statusMessage: [Getter]
} |
@ahuseyn It's fixed. I had some svelte stuff hanging there. I used the svelte and next/client-app-router-fetch-data as examples in this PR. You can review it briefly and let me know how it is, since I am not 100% ready but I think I'm getting there. I've added some basic styling and I'm trying to make any sample data visible and working (cats, tags, links clickable and routing correctly). |
Thanks @alexwpengine! I'll check ASAP. |
@alexwpengine, Please respond to and close any review comments. You don't have to implement if you disagree, but please communicate your decisions. UPDATE: Oops, I never submitted my review. My bad... it's there now |
examples/next/hybrid-sitemap-apollo/example-app/src/pages/sitemap.xml.js
Outdated
Show resolved
Hide resolved
generalSettings { | ||
title | ||
} | ||
menu(id: "primary", idType: LOCATION) { | ||
menuItems(first: 100, after: $after) { | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
nodes { | ||
id | ||
label | ||
uri | ||
parentId | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look to be 2 separate queries that could be made individually.
examples/nuxt/data-fetch/example-app/components/templates/Home.vue
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not handling the home route with the template hierarchy?
import PostTemplate from '../components/templates/single/Post.vue'; | ||
import PageTemplate from '../components/templates/single/Page.vue'; | ||
import NotFoundTemplate from '../components/templates/404.vue'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this means all templates are bundled together (unless Nuxt does some magic). This is not a pattern we want to demo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't the template hierarchy. It's a very simplified version. Check out my Asto or SvelteKit examples or their articles for info on implementing the template hierarchy correctly. https://wpengine.com/builders/astro-wordpress-routing-and-graphql/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll focus on it now.
I didn't do the template hierarchy because I thought it's about data fetching in this example and a very simplified way of routing. I agree it's much better that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep this simple you can leave it as is, it's up to you. I was under the impression you were doing something like my examples and if that's not the case feel free to keep it simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fine, I will do it so we can cover more cases in 1 example
Description
WIP
Related Issue
closes #174
Type of Change
How Has This Been Tested?
Screenshots
Checklist