Skip to content

Commit

Permalink
Merge pull request #83 from AbstractSDK/adair/app-261-implement-the-p…
Browse files Browse the repository at this point in the history
…ropagation-of-react-query-client-props

Allow dev to pass query client options
  • Loading branch information
adairrr authored Mar 18, 2024
2 parents b55c0e1 + 8d4ec17 commit 1801c69
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/new-socks-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@abstract-money/react": patch
---

Add query client options to abtsract provider
4 changes: 4 additions & 0 deletions packages/react/src/contexts/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { QueryClientProviderProps } from '@tanstack/react-query/src/QueryClientProvider'
import * as React from 'react'
import { Config } from '../create-config'

const ConfigContext = React.createContext<Config | undefined>(undefined)

export type AbstractConfigProps = {
config: Config
queryClientOptions?: Partial<
Omit<QueryClientProviderProps, 'children' | 'contextSharing'>
>
}

export function AbstractConfigContext({
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/contexts/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type AbstractProviderProps = AbstractConfigProps
export function AbstractProvider({
children,
config,
queryClientOptions,
}: React.PropsWithChildren<AbstractProviderProps>) {
// Bailing out of using JSX
// https://github.com/egoist/tsup/issues/390#issuecomment-933488738
Expand All @@ -35,7 +36,8 @@ export function AbstractProvider({
// biome-ignore lint/correctness/noChildrenProp: <explanation>
children: React.createElement(QueryClientProvider, {
children,
client,
client: client,
...queryClientOptions,
}),
}),
})
Expand Down

0 comments on commit 1801c69

Please sign in to comment.