Skip to content
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: create and edit release plan template milestones #8768

Merged
merged 9 commits into from
Nov 19, 2024

Conversation

daveleek
Copy link
Contributor

Adding and editing milestones and their names

image

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 0:26am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Nov 19, 2024 0:26am

Copy link
Contributor

github-actions bot commented Nov 15, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

)}
{!editMode && (
<StyledEditIcon onClick={editMilestoneNameClick} />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this a part of the above block, since the condition is the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, I moved things around and forgot to remove the duplicate condition 🙄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could have added the onClick handler on the parent component, catching any click in the children, instead of duplicating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parent is the same for this and the other section which is only shown during edit mode, and would have a weird effect if you click inside. I'll have a think if I can introduce a parent just for these two while doing add strategies


return (
<>
{milestones.map((milestone, index) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try not to rely on the index here. It's going to be especially troublesome if we decide to allow the user to sort / change the order of the milestones.

Ideally you would have unique ids you could use for each milestone, however those are generated only in the backend. My suggestion is creating temporary uuids in the frontend for state management and omitting them from the final payload.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think relying on indexes here will bite you down the line, but if you're willing to accept that then feel free to proceed for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to have a look at that together with adding strategies!

@@ -24,5 +24,17 @@ export interface IReleasePlanTemplatePayload {
id?: string;
name: string;
description: string;
milestones?: IReleasePlanMilestone[];
milestones?: IReleasePlanMilestonePayload[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a payload instead of just IReleasePlanMilestone?

Copy link
Contributor Author

@daveleek daveleek Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look at the types when doing add strategies :)

Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should take another look at some of these points before merging:

  • Duplicated code between CreateReleasePlanTemplate and EditReleasePlanTemplate
  • State management
  • Relying on index for milestone management

Cancel
</StyledCancelButton>
</StyledButtonContainer>
</TemplateForm>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think you could have potentially merged the edit and create components into a single one, with a simple const isEdit = Boolean(templateId), but this is probably fine for now, and has much less duplicated code than before, so good job 👍

errors,
clearErrors,
}: IMilestoneList) => {
const [currentMilestone, setCurrentMilestone] = useState(-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use IReleasePlanMilestonePayload | undefined here? Should be more explicit than -1 and indexes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is for adding strategies to the milestone. Current milestone (should probably be named ...index) gets passed to the add strategy form. If we're adding something to that object (like we do with names) it should be bubbled up no?

Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely better now, especially the create / edit component part.

We already discussed the points I'm worried about, so I'll leave you a non-blocking approval and leave the decision up to you. Some of the issues I'm concerned about you'll eventually be forced to tackle, even if it's later down the line.

@daveleek daveleek merged commit 8935a01 into main Nov 19, 2024
11 checks passed
@daveleek daveleek deleted the feat/release-plans-milestones-add-edit branch November 19, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants