Kong / swrv

Stale-while-revalidate data fetching for Vue

Home Page:https://docs-swrv.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught (in promise) TypeError: Cannot read property 'proxy' of null

justmealf opened this issue · comments

Calling function got "Uncaught (in promise) TypeError: Cannot read property 'proxy' of null"

`const fetchData = () => {
useSWRV('https://swapi.dev/api/vehicles/?format=json', url => fetch(url).then(r => r.json()).then(
res => {
vehicles.value = res.results;
filteredData.value = res.results;
}
));
}

const getVehicleName = () =>{
filteredData.value = vehicles.value;
fetchData()
}`

Did i miss something?

Also got hit by this. In my case I was calling useSWRV from a .js file that was imported into a Vue component. It seems SWRV does not like this, useSWRV needs to be called from a Vue component. After moving the useSWRV invocation within <script setup>, the issue got away.

It would appear that this commit 6657caa is smh missing in the 1.0.0-beta.8 release.

This then causes the above mysterious error message which is not exactly helpful in facilitating problem diagnosis.

probably need to cherry pick the helpful log into the next branch, but closing since there's a workaround.