Skip to content

winners don't do null - #843

Merged
niik merged 6 commits into
masterfrom
electron-window-state-fix
Jan 24, 2017
Merged

niik merged 6 commits into
masterfrom
electron-window-state-fix

Conversation

@shiftkey

Copy link
Copy Markdown
Member

The one and only @robrix found an issue with his beta install, where the window-state.json file at ~/Library/Application Support/GitHub Desktop/ looked like this:

{"width":1440,"height":900,"isMaximized":true,"isFullScreen":true,"displayBounds":{"x":0,"y":0,"width":1440,"height":900},"x":null,"y":0}

The "x": null value at the end triggers an error inside electron-window-state when it does screen.getDisplayMatching() and prevents the app from launching. The serializing of the values is now corrected in mawie81/electron-window-state#16, but that doesn't help existing installs who might already be in a broken state.

I've taken a stab at this in f0a4e23 but perhaps it's not necessary - and removing the file is a "good enough" workaround here. @desktop/core let me know your feels on including that too.

@caged

caged commented Jan 23, 2017

Copy link
Copy Markdown

I've taken a stab at this in f0a4e23 but perhaps it's not necessary - and removing the file is a "good enough" workaround here. @desktop/core let me know your feels on including that too.

Just providing another datapoint. I ran into this issue and removing window-state.json file worked.

@shiftkey

shiftkey commented Jan 24, 2017 •

Copy link
Copy Markdown
Member Author

Given the integration test should run this workaround code, I'm not sure this has been the root cause of our issue with launch failures. Gonna dig into this today and see if I can recreate it locally...

EDIT: Nevermind, this was just my naive fix not picking up the fact that the build servers didn't have the cached window-state.json config file.

@shiftkey
shiftkey force-pushed the electron-window-state-fix branch from d6fd1e7 to 46bd0c2 Compare January 24, 2017 11:30
@shiftkey shiftkey changed the title winners don't do null [WIP] winners don't do null Jan 24, 2017
@shiftkey
shiftkey force-pushed the electron-window-state-fix branch from 46bd0c2 to f0a4e23 Compare January 24, 2017 11:41
@shiftkey
shiftkey force-pushed the electron-window-state-fix branch from 83a8b37 to 9c098d0 Compare January 24, 2017 12:13
@shiftkey shiftkey changed the title [WIP] winners don't do null winners don't do null Jan 24, 2017
@niik niik self-assigned this Jan 24, 2017
Comment thread app/src/main-process/app-window.ts Outdated
}

let text: string | null = null
const result = Fs.readFileSync(filePath)

This comment was marked as spam.

Comment thread app/src/main-process/app-window.ts Outdated

if (text) {
const json = JSON.parse(text)
if (json.x === null) {

This comment was marked as spam.

Comment thread app/src/main-process/app-window.ts Outdated
const file = 'window-state.json'
const filePath = Path.join(userData, file)

if (!Fs.existsSync(filePath)) {

This comment was marked as spam.

@shiftkey

Copy link
Copy Markdown
Member Author

🐨

@niik

niik commented Jan 24, 2017

Copy link
Copy Markdown
Member

@shiftkey What about the part of only writing when necessary: #843 (comment) ?

@shiftkey

Copy link
Copy Markdown
Member Author

@niik oops, I missed that check. Let me make this conditional.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants