vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.39k stars 352 forks source link

setPageContextPrefetchCache() called on SSG page, with isBrilloutDocpress() false #1920

Closed lfos closed 1 month ago

lfos commented 1 month ago

Description

The following error is sometimes being triggered when using client-side navigation. Edit: Correction - the error actually seems to occur when hovering over internal links (and before clicking).

Uncaught (in promise) Error: [vike@0.4.198][Bug] You stumbled upon a Vike bug. Go to https://github.com/vikejs/vike/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).
    at createErrorWithCleanStackTrace (createErrorWithCleanStackTrace.js:4:17)
    at assert (assert.js:54:27)
    at setPageContextPrefetchCache (prefetch.js:73:5)
    at prefetchPageContextFromServerHooks (prefetch.js:61:5)
    at async prefetch.js:212:21
    at async Promise.all (index 1)
    at async prefetchOnEvent (prefetch.js:199:5)

The assert() is the following from setPageContextPrefetchCache():

assert(isBrilloutDocpress()); // Ensure this API isn't used by anyone else

I also have random long delays in navigation, likely somewhere between page transition start and the onBeforeRender() hook, which I am currently trying to troubleshoot -- they may or may not be related.

Please let me know if you need more details to investigate/reproduce.

lfos commented 1 month ago

FWIW, this is the call stack at the assert():

20241011_21h57m09s_grim

brillout commented 1 month ago

Thank you, I see what's going on. Let me fix this.

brillout commented 1 month ago

Fix pre-released as 0.4.198-commit-77f6a27. Let me know if you still run into any issues.