Is it possible to exclude a component from a cached route?
In a project, I have routeRules like:
Pages get cached correctly, and inside some pages I use
If routeRules are not caching the page,
However, as soon as the above rules are implemented, it starts warning about hydration errors, as the SSR is returning cached html that is no longer valid.
Here's a reproduction of the issue.
https://stackblitz.com/edit/nuxt-starter-ttceua?file=nuxt.config.ts
(just comment the routeRules to observe the disappearance of hydration errors when the rules are disabled).
Is there a way to exclude certain components from routeRules cache? I couldn't find a way to do so.
Pages get cached correctly, and inside some pages I use
@nuxtjs/device to render different components if its mobile or not.If routeRules are not caching the page,
@nuxtjs/device is able to SSR the correct component.However, as soon as the above rules are implemented, it starts warning about hydration errors, as the SSR is returning cached html that is no longer valid.
Here's a reproduction of the issue.
https://stackblitz.com/edit/nuxt-starter-ttceua?file=nuxt.config.ts
(just comment the routeRules to observe the disappearance of hydration errors when the rules are disabled).
Is there a way to exclude certain components from routeRules cache? I couldn't find a way to do so.
StackBlitzUrb Gim Tam
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.