Skip to content

Commit

Permalink
refactor(solid-query): destructure query client provider props
Browse files Browse the repository at this point in the history
destructuring these props then makes it match the react-query implementation
  • Loading branch information
tludlow committed Dec 28, 2022
1 parent 82003f6 commit 96b5eb5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/solid-query/src/QueryClientProvider.tsx
Expand Up @@ -30,19 +30,21 @@ export type QueryClientProviderProps = {
children?: JSX.Element
} & ContextOptions

export const QueryClientProvider = (
props: QueryClientProviderProps,
): JSX.Element => {
export const QueryClientProvider = ({
client,
children,
context,
}: QueryClientProviderProps): JSX.Element => {
onMount(() => {
props.client.mount()
client.mount()
})
onCleanup(() => props.client.unmount())
onCleanup(() => client.unmount())

const QueryClientContext = getQueryClientContext(props.context)
const QueryClientContext = getQueryClientContext(context)

return (
<QueryClientContext.Provider value={props.client}>
{props.children}
<QueryClientContext.Provider value={client}>
{children}
</QueryClientContext.Provider>
)
}

0 comments on commit 96b5eb5

Please sign in to comment.