Comments (7)
@AdrianFahrbach You can also set experimental.payloadExtraction
to true to ensure useAsyncData
only runs on the server for all routes.
from nuxt.js.
You can pass the external
prop to force a hard reload, though note this will probably lead to a worse UX.
from nuxt.js.
You can pass the
external
prop to force a hard reload, though note this will probably lead to a worse UX.
then there's no correct way to prevent page do client requests when they should be server side?
from nuxt.js.
i think it sounds insecure. like, what if i pass secret api key which only server should use? creating nuxt api layer to proxy sounds not that good if not every route requires this type of key.
from nuxt.js.
You can pass the
external
prop to force a hard reload, though note this will probably lead to a worse UX.
and it doesn't work !)
const handlePayment = async () => {
// TODO: handle payment
return navigateTo('/delivery/' + offerId, {
external: true,
});
};
still client requests on the navigated page, and even when i move in history like clicking back and forward buttons in browser i see client requests. would be cool to see some info on nuxt docs about this type of simple tasks, how to make it correct way how nuxt devs would do it.
from nuxt.js.
Please provide a reproduction if it doesn't work.
I would recommend you consider server components or create a BFF using Nitro server routes.
from nuxt.js.
So the only ways to solve this are:
- External links everywhere (basically not using
NuxtLink
) - Wrapping server side api requests into a server component
- BFF Nitro server routes
@danielroe Do you have improvements for this planned in the future? I would definitely prefer an option to force useAsyncData
to only run on the server.
Could you also elaborate on the BFF Nitro server route approach a bit? My guess is that the solution there would be to create an internal API route that caches the data fetched from external sources, but still gets called on the client.
from nuxt.js.
Related Issues (20)
- Hydration mismatch when using `Teleport` in combination with `useHead` scripts at `'bodyOpen'` position HOT 3
- useFetch returns null used in component when on parent data is loaded via composable useFetch on route watch HOT 5
- Unusaual page reload after creating file in server event handler HOT 1
- Package manager order in docs/getting-started/installation HOT 2
- Useless sourcemaps generated during production build
- useSEOMeta or useHead, og tag dynamic assigned by requests can't not be fetch by FB or LINE sharing HOT 6
- After importing the @ nuxtjs/i18n module, the automatically imported function cannot find the type declaration in the template HOT 1
- Nuxt3.12.0 cant use nuxt-socket-io HOT 2
- hooks not called HOT 2
- Cannot read properties of undefined (reading 'replace') HOT 4
- protocol relative `cdnUrl` creates prerendering errors HOT 2
- cloudflare-pages does not generate static pages HOT 3
- SWR Cache saving headers HOT 2
- Nuxt $fetch throws exception when accessing API with subdomain HOT 2
- [SSG] Implement Route-Based Dynamic SEO Meta Tags in SSG HOT 4
- [Docs]: vue-tsc version are different in actual .md file and docs site HOT 1
- Creating new Nuxt 3 project results in multiple issues on Windows 10 HOT 2
- Change .env file does not update runtimeConfig HOT 1
- Route Groups not working HOT 2
- the unscoped css in a layout remains even after changing the layout in dev `nuxt dev` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.js.