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

Add reset number of commits to show for a branch button to experiments table #4355

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Jul 26, 2023

Related to #4269

Add a way to reset number of commits per branch.

Demo

Screen.Recording.2023-07-26.at.2.45.35.pm.mov

@mattseddon mattseddon added the product PR that affects product label Jul 26, 2023
@mattseddon mattseddon self-assigned this Jul 26, 2023
@mattseddon mattseddon marked this pull request as ready for review July 26, 2023 05:17
Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

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

Great work!

))}
{commitsButtons.map(commitButton => {
const { key, ...commitButtonProps } = commitButton
return <CommitsButton key={key} {...commitButtonProps} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the index provided by the map function as the key value? Then we could remove the key pair from the commitsButton arr.

@@ -478,6 +478,10 @@ export class ExperimentsModel extends ModelWithPersistence {
this.persistNbOfCommitsToShow()
}

public resetNbfCommitsToShow(branch: string) {
delete this.numberOfCommitsToShow[branch]
Copy link
Contributor

Choose a reason for hiding this comment

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

I've looked over the code multiple times but I can't figure out how this change is saved in the state across sessions. The function only touches this.numberOfCommitsToShow yet if I reload the window, the change is saved so the numberOfCommitsToShow is being persisted somewhere, right? How is it working though 😅 What am I missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

The memento could just be holding a reference to the original object. I will make an update.

@mattseddon mattseddon force-pushed the add-reset-commits branch 2 times, most recently from afc8dd4 to 0c1190c Compare July 26, 2023 18:48
@mattseddon mattseddon enabled auto-merge (squash) July 26, 2023 18:49
@codeclimate
Copy link

codeclimate bot commented Jul 26, 2023

Code Climate has analyzed commit fed39c4 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.2% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon merged commit 65e19db into main Jul 26, 2023
3 checks passed
@mattseddon mattseddon deleted the add-reset-commits branch July 26, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants