-
Notifications
You must be signed in to change notification settings - Fork 33
Allow user to cancel proposed changes actions #6846
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
CodSpeed Performance ReportMerging #6846 will not alter performanceComparing Summary
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
setting approved_by
and rejected_by
to read-only makes sense to me
decision: string; | ||
} | ||
|
||
export function udpateReviewFromApi({ |
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.
- There is a typo
udpate
- I suggest to add more context in the name of the function: Review -> ProposedChangeReview
branchName, | ||
}: UpdateReviewFromApiApiParams) { | ||
return graphqlClient.mutate({ | ||
mutation: gql(MUTATION), |
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.
use gql
in the query directly to have graphql autocompletion and highlight.
decision, | ||
}, | ||
context: { | ||
branch: branchName, |
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 branch really needed? Are proposed change branch-agnostic?
|
||
export const PROPOSED_CHANGE_STATES = { | ||
opened: ["open", "merging"], | ||
closed: ["closed", "merged", "canceled"], |
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.
you could reuse const declared above
branchName: currentBranch.name, | ||
}); | ||
}, | ||
mutationKey: ["propose-changes-action"], |
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.
mutationKey is not needed
|
||
export type UpdateReview = (data: UpdateReviewFromApiApiParams) => Promise<void>; | ||
|
||
export const updateReview: UpdateReview = async (params) => { |
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.
same here and on hooks. Add more context on function name. It's too wide rn
import { User } from "@/entities/authentication/ui/useAuth"; | ||
import { NodeObject } from "@/entities/nodes/types"; | ||
|
||
export const hasUserRejected = (proposedChangesDetails: NodeObject, user: User | null) => { |
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.
- name is again too broad. hasUserRejected -> hasUserRejectedProposedChange
- Also, from the name, I'd expect user not to be null. If it is null, that should be handled earlier before calling the function.
import { User } from "@/entities/authentication/ui/useAuth"; | ||
import { NodeObject } from "@/entities/nodes/types"; | ||
|
||
export const hasUserApproved = (proposedChangesDetails: NodeObject, user: User | null) => { |
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.
same than about hasUserRejected
approvers={approvers} | ||
proposedChangeId={proposedChangeId!} | ||
state={state} | ||
disabled={!permission.update.isAllowed} |
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.
the new component PcActionButton seems to not take props?
|
||
const { mutateAsync, isPending } = useUpdateReview({ | ||
onSuccess: async () => { | ||
await graphqlClient.reFetchObservableQueries(); |
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.
missing update on query using tanstack query no?
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.
tanstack is not used (yet...) for the details view
const handleAction = (event: React.MouseEvent<HTMLButtonElement>) => { | ||
event.stopPropagation(); | ||
|
||
mutateAsync({ |
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.
use normal mutate instead of mutateAsync is there is no await
Uh oh!
There was an error while loading. Please reload this page.