Skip to content

Summary is not cleared after commit #4046

Closed

Description

@svivian

Description

Sometimes, when making a commit, the Summary line is not cleared after commit. The app ends up like this:

github-summary

The commit has gone through but the summary is still there. I reported this a while back via email but it still happens occasionally.

This seems to happen on occasions when my laptop is running slowly. Usually I've switched to another app while the commit is happening. But when I switch back, the Summary line is there.

Version

GitHub Desktop version: 1.0.13
OS version: macOS High Sierra 10.13.3

Steps to Reproduce

  1. Write a commit summary.
  2. Click "Commit to master".
  3. Switch to another app.
  4. Switch back after a few seconds.

Logs

Here's the log from around the time the commit was made:

2018-02-19T16:27:05.970Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 1.034s)
2018-02-19T16:27:18.902Z - info: [ui] Executing getPartialBlobContents: git show 2416b854c041a315d22991b67eb9e2eb64de850c^:FILE (took 1.147s)
2018-02-19T16:27:20.234Z - info: [ui] Executing getCommits: git log HEAD --date=raw --max-count=100 --pretty=%H%x1F%s%x1F%b%x1F%an <%ae> %ad%x1F%cn <%ce> %cd%x1F%P%x1F%(trailers:unfold,only) -z --no-color --not --remotes -- (took 2.535s)
2018-02-19T16:27:22.228Z - info: [ui] Executing getPartialBlobContents: git show HEAD:FILE (took 1.105s)
2018-02-19T16:27:26.382Z - info: [ui] Executing unstageAll: git reset -- . (took 29.270s)
2018-02-19T16:27:29.557Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 12.745s)
2018-02-19T16:27:29.561Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 24.590s)
2018-02-19T16:27:29.564Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 21.262s)
2018-02-19T16:27:29.572Z - info: [ui] Executing updateIndex: git update-index --add --remove --replace -z --stdin (took 3.189s)
2018-02-19T16:27:33.398Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 12.327s)
2018-02-19T16:27:33.407Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 28.518s)
2018-02-19T16:27:33.479Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 25.187s)
2018-02-19T16:27:33.499Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 16.700s)
2018-02-19T16:27:35.414Z - info: [ui] Executing createCommit: git commit -F - (took 5.842s)

Activity

  1. added
    investigation-needed
    on Feb 21, 2018
  2. shiftkey commented on Apr 9, 2018

    @shiftkey
    Member

    A few attempts at recreating this and I haven't been able to trigger it, but the area of code to focus on is here:

    const commitCreated = await this.props.onCreateCommit(
    summary,
    description,
    trailers
    )
    if (commitCreated) {
    this.clearCommitMessage()
    }

    In theory we should only be clearing the commit form when the commit is successful, and logs don't suggest an error is occurring when committing, but maybe there's some detail that I've not caught yet.

    I'll also point out that there's several getStatus calls that occur in between staging and committing, each taking significantly long to complete, and this might be part of the repro:

    2018-02-19T16:27:33.398Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 12.327s)
    2018-02-19T16:27:33.407Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 28.518s)
    2018-02-19T16:27:33.479Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 25.187s)
    2018-02-19T16:27:33.499Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 16.700s)
    
  3. mcmonkey4eva commented on Jun 8, 2018

    @mcmonkey4eva

    I've had this happen a lot, whenever GitHub Desktop is lagging (not my PC lagging, GitHub Desktop lagging. Not sure where that discussion goes but will throw it into #4290 and move if requested).

    I'm running on release version 1.2.3 of GitHub Desktop (current as of post time) + Windows 10 Home (not sure about Win10 version code, but the current one for start of June 2018)

    As far as recreation, my best guess as to a good way would be to manually induce lag in the app while making a commit. Possibly intentionally modify the git calls to take much longer than needed.

  4. kdorsel commented on Jun 11, 2018

    @kdorsel

    I just got the same behavior. GitHub Desktop was indeed lagging significantly also. I'm on windows 7 running 1.2.3.

    It took 1-2 seconds after clicking commit for the pull/push button to update showing there's a commit to push.
    Looking under history it took 3-5 seconds for the commit to show up. I was able to switch back and forth from it a few times before it showed.

    Both the Summary and Description were not cleared.

    I created a test branch and tried committing a few more, there's a ~7s delay before the summary gets cleared and the commit callbacks finish, but it works now. This was done before a restart. Restarting the client yields the same results.

  5. svivian commented on Jul 20, 2018

    @svivian
    Author

    OK I've found one way to reproduce this.

    1. Make some changes, and on the Changes tab type a summary and click the "Commit to master" button.
    2. Switch to the History tab. I thought the commit has already been made but probably in my case the summary field had not yet been cleared.
    3. Switch back to the Changes tab.

    The summary I typed is still there. I'm not sure if this is the only way, I think in the past I've pressed the commit button and switched to another app, maybe that has the same effect (Github Desktop is not active to the field is not cleared).

  6. added
    bug
    and removed
    investigation-needed
    on Jul 20, 2018
  7. self-assigned this
    on Jul 20, 2018
  8. added this to the 1.3.x milestone on Jul 20, 2018
  9. shiftkey commented on Jul 20, 2018

    @shiftkey
    Member

    I think I know what this is, and it's due to two things:

    • the commit result inside CommitMessage doesn't signal to the AppStore to clear the commit message (it just does a setState internally to clear the form)
    • unmounting CommitMessage means the state isn't cleared, and when you return to it you'll inherit whatever was in the AppStore (aka your previous commit)

    I've opened #5208 which should be the right fix

  10. shiftkey commented on Jul 27, 2018

    @shiftkey
    Member

    Reopening this because it's not as simple a fix as I'd hoped

  11. removed their assignment
    on Aug 27, 2018
  12. removed this from the 1.3.x milestone on Aug 31, 2018
  13. added
    help wanted
    priority-3
    on Oct 11, 2018
  14. StefKors commented on Feb 14, 2019

    @StefKors

    I'm having a similar issue, where after the inactive state is removed it takes a couple seconds before the input is cleared.

    Perhaps it's possible to clear the input immediately after the inactive state is removed?

    github desktop

  15. steveward commented on Mar 11, 2019

    @steveward
    Contributor

    Reported in #7061 by @AlcaDesign:

    Pressing the "commit" button and then switching to the "History" tab before the commit finishes will keep the commit summary/description. It clears after a moment if you do nothing after pressing commit. Switching the tab view early shouldn't keep the message.

    Steps to Reproduce:

    1. Make a change in a connected repository.
    2. Add a summary and/or description message in the UI.
    3. Press the "Commit to branch" button and then quickly switch to the "History" tab.
    4. Return to the "Changes" tab and see the summary and description fields still filled.
  16. shiftkey commented on Jun 14, 2019

    @shiftkey
    Member

    Reported in #7801 by @kkocdko (same steps to reproduce as #4046 (comment))

  17. terreng commented on Jul 25, 2019

    @terreng

    Here's a GIF:

  18. StefKors commented on Jul 26, 2019

    @StefKors

    I think clearing the input earlier or creating a loading state will solve this issue

  19. samuelko123 commented on Apr 23, 2023

    @samuelko123
    Contributor

    Hi @shiftkey, I would like to help on this issue.

    I read from #5269 that you want to build some automated tests around the code, but I couldn't find many front-end tests in the repo other than app-test.tsx. I believe we can use tools like Testing Library to render the App, simulate keyboard and mouse events, then assert front-end visual results. Currently, running app-test.tsx takes 7.5s on my laptop. It wouldn't be too bad if we're to create another one.

    In terms of the fix itself:
    Problem 1 - Message persisted when it shouldn't
    Solution 1 - Clear the message at the start of commit
    Problem 2 - If we clear the message, it will be lost if commit is not successful
    Solution 2 - Add previousCommitMessage to the store per repo, and create a button with an undo icon plus tooltip "restore previous message", so user can restore the lost message

    I'm happy to help with both building the tests and the fix.

    Hope it makes sense.

  20. shiftkey commented on Apr 23, 2023

    @shiftkey
    Member

    @samuelko123 I'm no longer involved with this project so I'm not sure what the recommended approach is for this currently, but otherwise feel free to take a shot at fixing this bug...

  21. svivian commented on Apr 23, 2023

    @svivian
    Author

    I haven’t experienced this bug for years, so it must have been fixed a while back.

  22. samuelko123 commented on Apr 23, 2023

    @samuelko123
    Contributor

    @shiftkey Thanks for letting me know. I'll wait for the maintainers then.

    @svivian The bug still exists today. Maybe commit becomes quicker these days, so it's harder to encounter. Anyway, let's see whether someone else would raise the same bug again.

    before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions