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
I use async Selector, I want to return extra info when the atom in loading state, how should I implement it?
it seems when in loading state, the content cannot inclue extra info.
I can return like this, the data is promise, this is too ugly , I need to await in Component to fetch the data
return { query,data:getData(get(queryAtom)) }
like this:
constqueryAtom=atom({key: "query",default: ""});constdataAtom=selector({key: "data",get: async({ get })=>{// I want to return some extra info before fetching data, how to return this? constdata=awaitgetData(get(queryAtom));returndata;// I can return like this, the data is promise, this is too ugly , I need to await in Component to fetch the data// return { query,data:getData(get(queryAtom)) } }});
The text was updated successfully, but these errors were encountered:
I use async Selector, I want to return extra info when the atom in loading state, how should I implement it?
it seems when in loading state, the content cannot inclue extra info.
I can return like this, the data is promise, this is too ugly , I need to await in Component to fetch the data
return { query,data:getData(get(queryAtom)) }
like this:
The text was updated successfully, but these errors were encountered: