You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grayed out menu items, "Cannot read property 'toLowerCase' of undefined" #6313
I opened the dev tools and saw a JavaScript error repeated several times:
Version
GitHub Desktop:
1.5.1-beta0
Operating system:
macOS High Sierra 10.13.6
Steps to Reproduce
I'm not sure. I have been using the app all day with no troubles. I pushed up a branch and hit Cmd-R in the app to open the 'new pull request' page for the branch in my browser, and noticed no such page opened. I tried it a few more times, no luck. That's when I went to the menu and saw the option was grayed out, along with many other options.
Expected Behavior
Menu options would work and not be grayed out.
Actual Behavior
Many menu options are grayed out, including "About GitHub Desktop" which seems like it should always work.
The stack trace itself refers to line 518, which is the end of the function - but I think that's it's own confused way of saying the second case is undefined (based on my attempts to breakpoint here):
Maybe we have some cached users which don't have a login defined that we then try to cache. @cheshire137 was this occurring with a GitHub repository?
This happens to me periodically. Exiting and relaunching the app fixes it. Here's some recent JS console output when it occurred (version 1.6.3-beta2):
Marking as priority-2 because of the impact (menus not working). The presence of undefined makes me think something at runtime is violating the type checks we have setup in this area.
Thanks to @cheshire137 who helped test the build from #6940 and uncovered the problem commit involved with this.
I'll spare the person responsible who created the commit from being named, but this is the API response that GitHub returns to the app for this comment:
Because author is an empty object here (rather than null) this code path is tripped an object with an undefined name and login, and an empty email is returned:
We published 1.7.0-beta1 last week which I believe addresses these two identified issues, so for the moment I'm going to close this out as resolved pending it being available in production. If you spot something that you believe might be related to this, please open a fresh issue rather than add to the existing discussion.
Activity
iAmWillShepherd commentedon Nov 29, 2018
What happens if you restart the app? Is that state persisted?
cheshire137 commentedon Nov 30, 2018
Nope, exiting and reopening the app made it work normally again!
shiftkey commentedon Dec 17, 2018
Looking at the stack trace, it seems like this is the problem code:
The stack trace itself refers to line 518, which is the end of the function - but I think that's it's own confused way of saying the second case is undefined (based on my attempts to breakpoint here):
Maybe we have some cached users which don't have a
logindefined that we then try to cache. @cheshire137 was this occurring with a GitHub repository?cheshire137 commentedon Dec 17, 2018
It was!
cheshire137 commentedon Feb 25, 2019
This happens to me periodically. Exiting and relaunching the app fixes it. Here's some recent JS console output when it occurred (version
1.6.3-beta2):shiftkey commentedon Feb 25, 2019
Marking as
priority-2because of the impact (menus not working). The presence ofundefinedmakes me think something at runtime is violating the type checks we have setup in this area.shiftkey commentedon Feb 25, 2019
Thanks to @cheshire137 who helped test the build from #6940 and uncovered the problem commit involved with this.
I'll spare the person responsible who created the commit from being named, but this is the API response that GitHub returns to the app for this comment:
Because
authoris an empty object here (rather thannull) this code path is tripped an object with an undefinednameandlogin, and an emptyemailis returned:desktop/app/src/lib/stores/github-user-store.ts
Lines 254 to 268 in e5b1df6
We can relax the type declarations coming from the API to reflect this newly-discovered anarchy:
And this highlights the code we need to update to properly handle this case.
shiftkey commentedon Feb 26, 2019
After talking a bit more about this with @cheshire137 I wanted to clarify where my head is at:
My next steps are to try and trigger this problem state myself
shiftkey commentedon Feb 26, 2019
Dropping this down to
priority-3unless I can get an easy, consistent reproduction of the disabled menus state.shiftkey commentedon Mar 6, 2019
Alright, I've got what I believe is one reproduction of this issue:
You want to keep an eye on the
currentPopuproot state - initially this isnull:A couple of minutes after launching this will change to an object:
29is the enum code forMergeConflicts, and those branches are the ones associated with the earlier merge.And despite there not being a popup you'll see some of the menu items are disabled:
What happened? My guess:
AppStore.withPushPullFetchruns on the conflicted repositoryAppStore._refreshRepositoryAppStore.loadStatusAppStore._triggerConflictsFlowAppStore.showMergeConflictsDialogdespite not being the selected repository.menu-updategets stuck in this code path and assumes all the menu items should be disableddesktop/app/src/lib/menu-update.ts
Lines 300 to 302 in 8b3c974
shiftkey commentedon Apr 1, 2019
We published
1.7.0-beta1last week which I believe addresses these two identified issues, so for the moment I'm going to close this out as resolved pending it being available in production. If you spot something that you believe might be related to this, please open a fresh issue rather than add to the existing discussion.