Skip to content

Commit

Permalink
Revert "[failed attempt] add warning upon no <a> found"
Browse files Browse the repository at this point in the history
This reverts commit 63cf8e5.
  • Loading branch information
brillout committed May 11, 2024
1 parent 63cf8e5 commit 9210982
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions docs/pages/prefetchStaticAssets/+Page.mdx
Expand Up @@ -81,10 +81,6 @@ See also:
- [MDN > Web API > Window > matchMedia()](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia)
- [Stack Overflow > Detecting that the browser has no mouse and is touch-only](https://stackoverflow.com/questions/7838680/detecting-that-the-browser-has-no-mouse-and-is-touch-only/52854585#52854585)

## Debug

If you get the warning `No <a> tag found` then it most likely means that you need to `await` your React/Vue/... rendering/hydration in your <Link href="/onRenderClient">`onRenderClient()` hook</Link>.

## See also

- <Link href="/preloading" />
4 changes: 0 additions & 4 deletions vike/client/client-routing-runtime/prefetch.ts
Expand Up @@ -84,10 +84,6 @@ function addLinkPrefetchHandlers(pageContext: { exports: Record<string, unknown>
markAsAlreadyPrefetched(pageContext.urlPathname)

const linkTags = [...document.getElementsByTagName('A')] as HTMLElement[]
assertWarning(linkTags.length > 0, 'No <a> tag found, see https://vike.dev/prefetchStaticAssets#debug', {
showStackTrace: true,
onlyOnce: true
})
linkTags.forEach((linkTag) => {
if (globalObject.linkPrefetchHandlerAdded.has(linkTag)) return
globalObject.linkPrefetchHandlerAdded.set(linkTag, true)
Expand Down

0 comments on commit 9210982

Please sign in to comment.