Resource not being called when componet loads

I have create a resource, that i want to update when the "cursor" is changed. I followed the tutorial, but this dose not load when the componet loads.
const fetchSubjects = async (source: any, { value, refetching }: any) => {
console.log("fetching subjects", source, value);
return await await urqlClient().query(GET_SUBJECTS, { after: "", first: 2 }).toPromise();
};

export default function Subjects() {
const [cursor, setCursor] = createSignal();
const [subjects] = createResource(cursor, fetchSubjects);

....
const fetchSubjects = async (source: any, { value, refetching }: any) => {
console.log("fetching subjects", source, value);
return await await urqlClient().query(GET_SUBJECTS, { after: "", first: 2 }).toPromise();
};

export default function Subjects() {
const [cursor, setCursor] = createSignal();
const [subjects] = createResource(cursor, fetchSubjects);

....
1 Reply
lxsmnsyc
lxsmnsyc2y ago
it will not load since cursor doesn't have an initial value. You need to provide a non-nullish value first
Want results from more Discord servers?
Add your server