-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(client/v2): set context for queries #18323
Conversation
WalkthroughThe codebase has been updated to enhance the functionality of the Changes
Poem
TipsChat with CodeRabbit Bot (
|
@julienrbrt your pull request is missing a changelog! |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- client/v2/autocli/query.go (2 hunks)
Additional comments: 2
client/v2/autocli/query.go (2)
1-15: The new imports for "context" and "github.com/cosmos/cosmos-sdk/client" are appropriate for the changes made in this hunk.
116-121: The context of the command is now set with the client context. This allows the command to access the client context when executing. This is a good practice as it allows the command to have access to the necessary context when it is executed.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- client/v2/autocli/query.go (3 hunks)
Additional comments: 3
client/v2/autocli/query.go (3)
1-15: The new imports for "context" and "github.com/cosmos/cosmos-sdk/client" are correctly placed and formatted.
116-120: The context of the command is correctly set with the client context. This allows the command to access the client context when executing.
+ cmd.SetContext(context.WithValue(context.Background(), client.ClientContextKey, &b.ClientCtx))
- 129-131: The encoder options are correctly set after the context has been set. This ensures that the encoder options are applied correctly when the command is executed.
+ if noIndent, _ := cmd.Flags().GetBool(flags.FlagNoIndent); noIndent { + encoderOptions.Indent = "" + }
(cherry picked from commit 630836e)
Description
Fixes an issue where client.toml wouldn't be read for autocli queries.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking changeSummary by CodeRabbit
New Features:
BuildQueryMethodCommand
function in theautocli/query.go
file. The function now sets the context of the command with the client context, allowing the command to access the client context when executing. This change improves the command's functionality and interaction with the client context.Refactor:
autocli/query.go
file to set the encoder options after setting the context, improving the overall code structure and execution flow.