Skip to content

Commit

Permalink
updated solid query
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldemian authored and NeOMakinG committed Jan 16, 2023
1 parent 7b8211e commit 3ff6445
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.0",
"@tanstack/query-sync-storage-persister": "^4.14.5",
"@tanstack/solid-query": "^4.20.9",
"@tanstack/solid-query": "^4.22.0",
"@wagmi/core": "workspace:*",
"@walletconnect/ethereum-provider": "^1.8.0",
"abitype": "^0.2.5",
Expand Down
6 changes: 1 addition & 5 deletions packages/solid/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const Context = createContext<
>(undefined)

const queryClient = new QueryClient()
const queryClientContext = createContext<QueryClient | undefined>(queryClient)

export type WagmiConfigProps<
TProvider extends Provider = Provider,
Expand All @@ -25,10 +24,7 @@ export function WagmiProvider<
TWebSocketProvider extends WebSocketProvider,
>(props: ParentProps<WagmiConfigProps<TProvider, TWebSocketProvider>>) {
return (
<QueryClientProvider
context={queryClientContext}
client={props.client.queryClient ?? queryClient}
>
<QueryClientProvider client={props.client.queryClient ?? queryClient}>
<Context.Provider value={props.client as any}>
{props.children}
</Context.Provider>
Expand Down
5 changes: 3 additions & 2 deletions packages/solid/src/hooks/accounts/useAccount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const useAccountWithConnectAndDisconnect = () => {
}
}

const { result } = renderHook(() => useAccountWithConnectAndDisconnect())

describe('useAccount', () => {
describe('mounts', () => {
it('is connected', async () => {
const { result } = renderHook(() => useAccountWithConnectAndDisconnect())

// const connectData = renderHook(() => useConnect())

console.log('accountData -> ', result.account())

// console.log('connectData -> ', result.connect())

expect(true).toBeTruthy()
Expand Down
5 changes: 4 additions & 1 deletion packages/solid/src/hooks/accounts/useAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { createEffect, createSignal, onCleanup } from 'solid-js'
// import { useClient } from '../../context'

export const useAccount = () => {
// const [client] = useClient()
// const client = useClient()

// console.log('client -> ', client)

const [accountResult, setAccountResult] = createSignal<
GetAccountResult<Provider>
>({
Expand Down
4 changes: 2 additions & 2 deletions packages/solid/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const wrapper = ({
client = setupClient({ queryClient }),
...rest
}: Props = {}) => {
console.log('rest', rest)
return <WagmiProvider client={client as any} {...rest} />
}

Expand All @@ -33,6 +34,7 @@ export function renderHook(
// }),
// ...options_,
// }
// const utils = defaultRenderHook(hook, options as any)

queryClient.clear()

Expand All @@ -41,8 +43,6 @@ export function renderHook(
...options_,
} as any)

// const utils = defaultRenderHook(hook, options as any)

return {
...utils,
}
Expand Down
14 changes: 9 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ff6445

Please sign in to comment.