Subscribe on changes!

Missing LifecycleHooks.SERVER_PREFETCH in 'vue-next/packages/runtime-core/src/errorHandling.ts'

avatar
Jun 28th 2021

Version

3.1.2

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBsYW5nPVwidHNcIj5cbiAgaW1wb3J0IHsgb25TZXJ2ZXJQcmVmZXRjaCB9IGZyb20gJ3Z1ZSc7XG5cdG9uU2VydmVyUHJlZmV0Y2goKCkgPT4ge30pO1xuPC9zY3JpcHQ+In0=

Steps to reproduce

Accidentally stumbled onto this trying to configure apollo extension for quasar. Calling injectHook with LifecycleHooks.SERVER_PREFETCH as the first parameter causes an exception because the ErrorTypeStrings record does not contain an entry for LifecycleHooks.SERVER_PREFETCH.

What is expected?

A warning that i'm doing things wrong.

What is actually happening?

A confusing error.

avatar
Jun 28th 2021

@LordTerabyte The link is broken, can you fix it?

avatar
Jun 28th 2021

I'm trying, but honestly there is no reproduction code, because the missing thing is obvious just by looking at the source code. I literally just added a single line into "\node_modules@vue\runtime-core\dist\runtime-core.esm-bundler.js" and it fixed the problem.

Like this:

const ErrorTypeStrings = {
    ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook', // this line added
    ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
avatar
Jun 28th 2021

Just take a look please, I swear I'm not just wasting your time. Thank you!

avatar
Jun 28th 2021

If it helps, this seems to be a related issue.

avatar
Jun 28th 2021

I managed to actually setup a working reproduction link. That sfc playground is confusing.

avatar
Oct 6th 2023

@LinusBorg are these ErrorTypeStrings exported for use in a consuming package?

Example: I'm setting up a onErrorCaptured hook and while the info string has value while running the dev server (e.g. outputs mounted hook) it only returns an integer in production. I'd like to surface the actual underlying string mounted hook to our error logging but need access to ErrorTypeStrings in order to do so