Skip to content

Make useFlowChainId args consistent with other hooks #2506

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

Merged
merged 2 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-suns-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/kit": patch
---

Make `useFlowChainId` args consistent with other hooks
9 changes: 6 additions & 3 deletions packages/kit/src/hooks/useFlowChainId.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ describe("useFlowChainId", () => {
let hookResult: any

await act(async () => {
const {result} = renderHook(() => useFlowChainId(customOptions), {
wrapper: FlowProvider,
})
const {result} = renderHook(
() => useFlowChainId({query: customOptions}),
{
wrapper: FlowProvider,
}
)
hookResult = result
})

Expand Down
13 changes: 7 additions & 6 deletions packages/kit/src/hooks/useFlowChainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import {useFlowQueryClient} from "../provider/FlowQueryClient"
import {useCallback} from "react"
import {useFlowConfig} from "./useFlowConfig"

interface UseFlowChainIdArgs {
query?: Omit<UseQueryOptions<string | null, Error>, "queryKey" | "queryFn">
}

/**
* Gets the Flow chain ID.
*/
export function useFlowChainId(
queryOptions: Omit<
UseQueryOptions<string | null>,
"queryKey" | "queryFn"
> = {}
): UseQueryResult<string | null, Error> {
export function useFlowChainId({
query: queryOptions = {},
}: UseFlowChainIdArgs = {}): UseQueryResult<string | null, Error> {
const queryClient = useFlowQueryClient()
const config = useFlowConfig()

Expand Down