-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
feat: Change request applied diff for update strategy #8859
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
@@ -1,5 +1,5 @@ | |||
import type React from 'react'; | |||
import type { VFC, FC, ReactNode } from 'react'; |
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.
VFC is deprecated
currentStrategy: IFeatureStrategy | undefined; | ||
actions?: ReactNode; | ||
}> = ({ change, changeRequestState, currentStrategy, actions }) => { | ||
const name = |
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.
extracted DeleteStrategy component so that we can do the ifs checks outside of the inline calls
currentStrategy: IFeatureStrategy | undefined; | ||
actions?: ReactNode; | ||
}> = ({ change, changeRequestState, currentStrategy, actions }) => { | ||
const hasVariantDiff = hasDiff( |
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.
extracted component can have display data calculation outside of the inline calls
@@ -185,139 +326,35 @@ export const StrategyChange: VFC<{ | |||
<div>{actions}</div> | |||
</ChangeItemCreateEditDeleteWrapper> | |||
<StrategyExecution strategy={change.payload} /> | |||
<ConditionallyRender | |||
condition={hasVariantDiff} |
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.
for add strategy diff checking doesn't make sense
@@ -80,29 +78,32 @@ const Truncated = styled('div')(() => ({ | |||
})); | |||
|
|||
export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({ | |||
change, |
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 was unnecessary coupling
@@ -80,29 +78,32 @@ const Truncated = styled('div')(() => ({ | |||
})); | |||
|
|||
export const StrategyTooltipLink: FC<IStrategyTooltipLinkProps> = ({ | |||
change, | |||
name, |
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.
strategy name and title passing give us more flexibility in caller code (can select current live strategy vs snapshot depending on CR state)
}; | ||
|
||
type ChangeRequestDeleteStrategy = { | ||
id: string; | ||
name: string; | ||
name?: string; |
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.
for applied change requests this one is never provided
About the changes
Show correct title diff and payload diff (e.g. rollout %) when change request is applied
Previously we were always comparing title and payload against the current strategy. But after the strategy is applied there's no diff anymore. What's more when the strategy is updated in future we're diffing against a future value. This PR always looks at the snapshot for change request when the change request is applied.
I added tests showing both cases in detail.
There will be another PR in the backend to take a snapshot when the CR is being applied.
Also we should add snapshots for deleted strategies since so that we can show diffs for them after applying CRs.
Update: added delete strategies improvements and extract method refactor in this PR
Important files
Discussion points