-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query): add useQueriesState
composable
#35
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for funny-banoffee-0afb46 canceled.
|
@@ -173,7 +173,7 @@ export const useQueryCache = defineStore(QUERY_STORE_ID, () => { | |||
|
|||
function ensureEntry<TResult = unknown, TError = ErrorDefault>( | |||
keyRaw: EntryKey, | |||
options: UseQueryOptionsWithDefaults<TResult, TError>, | |||
options?: UseQueryOptionsWithDefaults<TResult, TError>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a query entry without options risks errors if the key is invalidated and the options
are accessed. Probably, we should consider avoiding creating query entities in UseQueryState
and return undefined/null
instead.
return keys.map<QueryState[]>( | ||
// TODO: fix TS issue | ||
(key) => { | ||
const query = ensureEntry(toValue(key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add and use the findQuery
function here? It will work if we decide not to create a query in useQueriesState
in case it has not been created
import type { QueryStatus } from './query-store' | ||
import { useQueryCache } from './query-store' | ||
|
||
interface QueryState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use _UseQueryEntry_State
type from query-store.ts
here?
No description provided.