question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clicking "Undo" button doesn't populate summary field

See original GitHub issue

Description

I have been using GitHub Desktop for months, and overall I’ve liked it, but something has been acting funny for the last week or two.

Before, whenever I clicked the “Undo” button to undo a commit, the summary and description fields get populated with the description of that commit.

But now, they don’t always get populated. It seems to work for a while, and then stop working, seemingly at random. If I restart GitHub Desktop, it starts working again for a while, then randomly stops again.

Before, I could easily make small changes to my latest commit, like running git commit --amend from the command line. But now, I have to re-type the summary and description, which can be especially annoying if those things are long, or if I simply don’t remember the description I had.

I’d like to see the old behavior, where the inputs are populated every time the “Undo” button is clicked.

Version

  • GitHub Desktop: 1.5.0
  • Operating system: macOS 10.13.6

Steps to Reproduce

Make a commit, then click the “Undo” button. You may need to try this several times, possibly after GitHub Desktop has been running for several hours.

Expected Behavior

The commit message does not always show in the summary field.

Actual Behavior

The commit message should always show in the summary field.

Logs

I am afraid to attach my log file because it may contain sensitive company information. Sorry. I may try to reproduce this on my home laptop, but I can’t promise that I will have time any time soon, or be able to reproduce it at all.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:24 (14 by maintainers)

github_iconTop GitHub Comments

6reactions
humphdcommented, Feb 24, 2019

I spent some time looking into this today, and was able to bisect it back to https://github.com/desktop/desktop/commit/6b9ca6cb7cdc12d6bdda4285874c1d4d813c3e61, which was part of https://github.com/desktop/desktop/pull/6037.

It stems from the way the props check happens in componentDidUpdate() of CommitMessage, specifically:

-if (prevProps.commitMessage !== this.props.commitMessage) {
+if (!shallowEquals(prevProps.commitMessage, this.props.commitMessage)) {

When this bug happens, and the commit message summary is lost, reference equality for these two props Objects is different but value equality is the same. So shallowEquals() rightly says that prevProps.commitMessage and this.props.commitMessage are the same, since the values for summary and description are the same.

If I revert this change, the bug is fixed, and even though the state should be the same (values are the same on previous and current), it forces an update, and whatever code that triggers to show the correct value.

I notice in https://github.com/desktop/desktop/pull/6037#discussion_r229748708 @shiftkey suggested the use of shallowEquals() here to reduce the number of setState() calls. I don’t work with react often enough to know what the right fix is, other than this switch back to reference equality. If @shiftkey or @outofambit have suggestions, I’d be willing to finish this. If they’d rather take it over, that’s fine too.

Let me know if I can help further. I wanted to do a walkthrough bug fix with my open source students, and picked this one so I could write it up.

5reactions
elias6commented, May 16, 2019

I noticed a fix for this bug mentioned in the release notes for 1.6.6. I haven’t seen it since I upgraded a few hours ago. Thanks to whoever fixed it. If I notice it again, I’ll post about it here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Populate summary field with static text + values from custom field
I am looking to populate the summary field for a certain request type with ... does not care about the summary and you...
Read more >
Roll-Up Summary Field - Salesforce Help
A roll-up summary field calculates values from related records, such as those in a related list. You can create a roll-up summary field...
Read more >
Overcoming Limitations in Salesforce Rollup Summary Fields
When you delete a child record on a Roll-up Summary field, Salesforce doesn't automatically recalculate the value of the field.
Read more >
Update fields - Microsoft Support
In a document you have open, right-click a field, such as a table of contents, a page number, or a cross-reference, and click...
Read more >
Undo and Redo - Tableau Help
In the upper-left corner of Tableau Desktop, Tableau Cloud, and Tableau Server, you can click Undo and Redo buttons. Here's how those buttons...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found