#createStore doesn't trigger createResource refetch action.

4 messages · Page 1 of 1 (latest)

static hamlet
#
const [pagination, setPagination] = createStore({page: 1, limit: 10});
const [perPage, setPerPage] = createSignal(10);
const [constructionData] = createResource(perPage, getConstructionList); // works
//const [constructionData] = createResource(pagination, getConstructionList); // does not work
//const [constructionData] = createResource({page: pagination.page, limit: pagination.limit}, getConstructionList); // tried to deconstruct signal, did not work too

How can I make createResource work with a store, if possible at all? When I pass a simple signal like perPage to createResource, it works smoothly. However, when I pass a whole store to it, it does not trigger the refetch.

crisp hornet
#

That's because only the leaves of the store tree are reactive, the branches are not.

static hamlet
#

Thought so, just wasn't sure. Gonna use regular signals for this then.

const [pagination, setPagination] = createSignal({page: 2, limit: 10});
It's working nicely.

formal osprey