You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using class components the preFetch hook is not called. This is because the preFetch function is located not under c but under c.__c when using class components. See:
In the client-prefetch.js this line checks if the preFetch function exists: .filter(m => m.c && typeof m.c.preFetch === "function") which is of course never true when the preFetch function is not located there.
This also needs to be adjusted for SSR as the same preFetch checking logic is applied there.
To Reproduce
Steps to reproduce the behavior:
Create a preFetch hook in the @Options decorator when creating a class component. For example:
Expected behavior
PreFetch should work for class components, so I guess the logic of checking the preFetch function should be extended to also account for class components.
Can this get some priority? Because we cannot really upgrade if this is not working properly because we do depend on the preFetch hook quite a bit.
The text was updated successfully, but these errors were encountered:
* fix(preFetch): Call preFetch with class components #8915
preFetch is now called when used inside @options() in a class component.
* Add comments and fix prefetch for App.vue
* Simplify code for reviews
Co-authored-by: Evert van der Weit <evert@mett.nl>
Describe the bug
When using class components the
preFetch
hook is not called. This is because the preFetch function is located not underc
but underc.__c
when using class components. See:In the
client-prefetch.js
this line checks if the preFetch function exists:.filter(m => m.c && typeof m.c.preFetch === "function")
which is of course never true when the preFetch function is not located there.This also needs to be adjusted for SSR as the same preFetch checking logic is applied there.
To Reproduce
Steps to reproduce the behavior:
Create a preFetch hook in the
@Options
decorator when creating a class component. For example:Expected behavior
PreFetch should work for class components, so I guess the logic of checking the preFetch function should be extended to also account for class components.
Can this get some priority? Because we cannot really upgrade if this is not working properly because we do depend on the preFetch hook quite a bit.
The text was updated successfully, but these errors were encountered: