-
-
Notifications
You must be signed in to change notification settings - Fork 721
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
refactor: extract add strategy diff #8877
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 |
> | ||
<StrategyDiff | ||
change={change} | ||
currentStrategy={currentStrategy} |
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.
we were relying on the fact that current strategy is undefined because we look it up by change payload id that happens to be missing in the add strategy change payload.
'id' in change.payload && strategy.id === change.payload.id
This is very difficult to reason about
> | ||
<StrategyDiff | ||
change={change} | ||
currentStrategy={undefined} |
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.
it's much more obvious when we pass undefined as currentStrategy for the AddStrategy component. You don't have to analyze useCurrentStrategy why it returns undefined
@@ -267,6 +267,56 @@ const UpdateStrategy: FC<{ | |||
); | |||
}; | |||
|
|||
const AddStrategy: FC<{ |
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 extract component refactoring with one minor change described below
</StyledBox> | ||
)} | ||
</> | ||
<AddStrategy change={change} actions={actions} /> |
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.
now AddStrategy is a one liner like UpdateStrategy and DeleteStrategy
About the changes
Extract component for AddStrategy
Also:
Important files
Discussion points