docs: warn about hydration issue with URL fragment (#24961)

This commit is contained in:
Julien Huang 2024-01-01 11:28:23 +01:00 committed by GitHub
parent d3ea8fed97
commit 4028d0cae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,4 +44,8 @@ Apart from dynamic parameters and query parameters, `useRoute()` also provides t
- `path`: encoded pathname section of the URL - `path`: encoded pathname section of the URL
- `redirectedFrom`: route location that was attempted to access before ending up on the current route location - `redirectedFrom`: route location that was attempted to access before ending up on the current route location
::callout
Browsers don't send [URL fragments](https://url.spec.whatwg.org/#concept-url-fragment) (for example `#foo`) when making requests. So using `route.fullPath` in your template can trigger hydration issues because this will include the fragment on client but not the server.
::
:read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/interfaces/RouteLocationNormalizedLoaded.html"} :read-more{icon="i-simple-icons-vuedotjs" to="https://router.vuejs.org/api/interfaces/RouteLocationNormalizedLoaded.html"}