-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Nuxt Generate - Page not showing any content client side, works fine server side. #8107
Comments
Hi @drewbaker It is hard to test your reproduction without any token to test actually. Also, it seems you depend on |
@Atinux sorry, what token do you need? They are all in FYI: I updated instruction to include that. |
And I don't think we use |
@Atinux just pushed an update that removes use of Also updated all packages and Nuxt
|
Just tried disabling all server and router middleware. No effect. |
@galvez gave me this temp solution:
Create a middleware/data.js with:
Change pages/_page.vue to:
Add "data" to router.middleware in nuxt.config.js. I should note that fetchPayload() won't actually "fetch" anything, it's accessing pre-loaded data. |
Sounds like the same issue as #7791. The 'solution' seems to be using |
@papertokyo yes that looks like the same issue we are having. I wish we knew more about what "pattern" is causing this. |
I've also come across this issue. I tried using |
I was only able to reproduce my issue due to a certain type of nesting of fetch()-implementing components when combined with nuxt-child (#7799), but it just seems that applying the payload back to the correct component isn't fully bullet-proof yet. |
I just tried making sure |
@Atinux Do you have any insight to this? Really would like to know if this is something that will be fixed, or if I should refactor around it (replace fetch with asyncData)? For some reason I get the feeling you guys will be improving fetch in Nuxt 3. |
It's partly related to my issue but not quite. In investigating my problem I discovered that static generation calls fetch() during the generate and then it's never called again in a static site :-( If you want code to be called on client side after a static generate, it appears you need to use one of the standard lifecycle hooks in Vue, such as created() or mounted(). I found this quite unexpected behaviour too - I would have thought fetch() should make it into a static render on the client side |
We found another way to trigger this. On a static generated site. Have a component that uses fetch(). Then set the the component :key to this.$route.path (in our case we wanted to trigger a v-show animation on page route change). It will load correctly on initial over load, and as you change route the fetch() will run again and be empty. |
We ran into the same problem. We are using fetch in our default layout component and nested in our page component. When navigating client side to such a route the nested page component is getting the wrong fetchKey because the fetch inside the layout component is not recognized anymore. This is in contrast to the sever side, where layout and page component had their fetch triggered. I think this case could be handled in |
@realityfilter yeah I agree it seems we need to have control over the fetchKey. Makes sense to me that fetch()'s return value should be the key. If no return value, then it can do the automatic one that it currently does. Or just have a |
I ran into this with using https://www.virtualsupporttalks.de/impressum/ If you open that page directly, you can see the content is there because it's correctly rendered server side. But it's gone after a moment and the page is blank. Also, I get this warning:
What I found strange when looking into the I've set the So I tried removing this and… everything works 😅 Could this be the problem? I have to add the EDIT: Nevermind, this problem is already mentioned here #8476 and should be solved here: #8489 – how satisfying that I was on the right track, though 😄 |
Closed in #8466. Would appreciate testing via |
Thanks @danielroe this is so massive for us. Love this. Thank you for fixing! Ran into some unrelated build errors over here #8508 Can confirm this works in When do you think this will land in a core 2.x release? |
@drewbaker It should land in 2.15... |
I can confirm this resolves the issue for me as well (tested in |
Any idea when this fix will be merged in? I have a project on hold for deployment awaiting this fix; while I'd like the answer to be "today" even just a rough guess would help me plan ahead 🙏🏼 |
Can't you use |
@Atinux I was under the impression that |
You can fix a version of |
@Atinux ok good to know, I may do just that. Just out of curiosity, since we're roughly 4 weeks from the last 2.x release, does that mean this will in fact be released soon? Again, just asking so I understand the release schedule |
We are a bit late on schedule since 2.15 includes a bigger change regarding PostCSS 8 so we need more internal testing before 😄 |
So I’m bumping this again to ask if this can be rolled out soon as part of a |
@Atinux & @drewbaker The fix for this bug, which was fixed and working in version Something changed between these two releases and this fix needs to be addressed again. 😭 |
@adamdehaven I can confirm we are seeing it NOT WORKING on |
@drewbaker @Atinux I just went through all the releases of So to be clear regarding this fix:
|
@adamdehaven @drewbaker Really appreciate your checking on this - you definitely caught a significant regression before release ❤️ - see #8802 |
I seem to be having a similar problem with a very basic reproduction repo on version ^2.15.7 |
Versions
Reproduction
This repo: https://github.com/funkhaus/fuxt
Demo is here: https://fuxt-funkhaus.netlify.app
Steps to reproduce
.example.env
to.env
nuxt generate
on above repo and deploy to Netlify (ornuxt start
locally)nuxt-link
and page new will be empty of any dynamic content.What is Expected?
Client side browsing should load content from payload onto the page.
What is actually happening?
So it seems server side is working fine. But client side is not. If you look at the network inspector in your browser as you move around the site, you'll see that
payload.js
is loading and looks to contain the correct code, but it never makes it onto the page for some reason.The site only contains a few
fetch()
methods here:https://github.com/funkhaus/fuxt/blob/master/pages/_page.vue
https://github.com/funkhaus/fuxt/blob/master/components/WpMenu.vue
https://github.com/funkhaus/fuxt/blob/master/components/WpSeo.vue
And a request in
nuxtServerInit
here:https://github.com/funkhaus/fuxt/blob/master/store/index.js#L60
It all seems to be inline with the way you recommend the use of
fetch()
, so I'm not sure what is not working? Perhaps it doesn't like GQL? Or the use of lodash_get
in thefetch()
?I wish there was more explanation of what
nuxt generate
andpayload
is doing behind the scenes so I could troubleshoot this myself.The text was updated successfully, but these errors were encountered: