T
TanStack14mo ago
deep-jade

Meta Tags & SEO

what's the best approach to this using tanstack router?
6 Replies
deep-jade
deep-jadeOP13mo ago
ping
harsh-harlequin
harsh-harlequin13mo ago
If you're using vite, I just modify the head tag inside /index.html, anything page specific I just use https://www.npmjs.com/package/react-helmet
npm
react-helmet
A document head manager for React. Latest version: 6.1.0, last published: 4 years ago. Start using react-helmet in your project by running npm i react-helmet. There are 4575 other projects in the npm registry using react-helmet.
sensitive-blue
sensitive-blue13mo ago
GitHub
nv-rental-clone/src/lib/hooks/useDocumentTitle.ts at master · SeanC...
Navotar with Tailwind and the Tanstack. Contribute to SeanCassiere/nv-rental-clone development by creating an account on GitHub.
GitHub
nv-rental-clone/src/routes/_auth/(dashboard)/index.tsx at 718d19c37...
Navotar with Tailwind and the Tanstack. Contribute to SeanCassiere/nv-rental-clone development by creating an account on GitHub.
fascinating-indigo
fascinating-indigo13mo ago
I saw this part of your code
const promises = [];

// get messages
promises.push(queryClient.ensureQueryData(dashboardMessagesOptions));

// get widgets
promises.push(queryClient.ensureQueryData(dashboardWidgetsOptions));

// get locations
promises.push(queryClient.ensureQueryData(activeLocationsOptions));

await Promise.all(promises);
const promises = [];

// get messages
promises.push(queryClient.ensureQueryData(dashboardMessagesOptions));

// get widgets
promises.push(queryClient.ensureQueryData(dashboardWidgetsOptions));

// get locations
promises.push(queryClient.ensureQueryData(activeLocationsOptions));

await Promise.all(promises);
If I don't use promise.all here ensureQueryData would cause a waterfall right? cause I didn't really check but seeing this made me realize in my project I didn't do this
sensitive-blue
sensitive-blue13mo ago
Yup! Whenever the order of the promise execution doesn't matter, I "collect" them and throw into a Promise.all or Promise.allSettled
fascinating-indigo
fascinating-indigo13mo ago
Thanks fixed my project to use this The order of execution doesn't matter

Did you find this page helpful?