-
Notifications
You must be signed in to change notification settings - Fork 128
Added useFlowQueryRaw hook #2523
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
Conversation
🦋 Changeset detectedLatest commit: 43cb3d8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Pull Request Overview
This PR adds a new hook, useFlowQueryRaw, to execute a Cadence script and obtain its raw query response without decoding it. Key changes include:
- Implementation of the useFlowQueryRaw hook integrating with react-query and fcl.rawQuery.
- Comprehensive tests for various scenarios including error handling, argument updates, and disabling queries.
- Updates and re-exports across related files to support the new hook.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/kit/src/hooks/useFlowQueryRaw.ts | New hook implementation for executing raw queries |
packages/kit/src/hooks/useFlowQueryRaw.test.ts | Added tests covering multiple use cases for the new hook |
packages/kit/src/hooks/index.ts | Exports new hook |
packages/kit/src/mocks/fcl.ts | Added mock for rawQuery |
packages/fcl/src/fcl.ts | Updated export for rawQuery |
packages/fcl-core/src/fcl-core.ts | Updated export for rawQuery |
packages/fcl-core/src/exec/raw-query.ts | New implementation of rawQuery function |
packages/fcl-core/src/exec/query.ts | Updated query function to work with rawQuery |
packages/fcl-core/src/exec/query.js | Removal of outdated query implementation |
.changeset/wicked-bikes-peel.md | Changeset documenting the new hook |
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.
Is this tested with harness?
|
||
// Encode the arguments to a JSON-CDC object so they can be deterministically | ||
// serialized and used as the query key. | ||
const encodedArgs = args?.(fcl.arg, fcl.t)?.map((x: any) => |
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.
This is in the useFlowQuery
file as well. Can we move it somewhere its shared?
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.
Yep, created encodeQueryArgs function and shared between hooks!
Yes, tested! |
Close #2407