Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Don't cascade on reload - #10743

Merged
joshaber merged 4 commits into
masterfrom
dont-cascade-on-reload
Feb 10, 2016
Merged

joshaber merged 4 commits into
masterfrom
dont-cascade-on-reload

Conversation

@joshaber

@joshaber joshaber commented Feb 9, 2016

Copy link
Copy Markdown
Contributor

Fixes #10648.

So this fix is a little fussy.

  1. Ideally we’d simply update the window load settings with the window dimensions before we reload, so that the reloaded window has the same dimensions.
  2. But any changes we make to the window load settings in our beforeunload handler aren’t reflected in the reload. (I suspect Chromium’s grabbing the location for reload before calling the handler?)
  3. So the next best thing: we detect a reload before beforeunload is called and update the window load settings there. This worked for most reloads but I wasn’t able to find a hook for reloads triggered by cmd-r with the dev tools focused. That inconsistency would have been super annoying, to me at least.
  4. So instead we track whether this is the first time the window’s been loaded. If it is, we use the default dimensions. If it isn’t, we use the dimensions we’re already saving in state.

@atom/core I’m curious if I’ve totally overcomplicated this or missed anything obvious.

@joshaber joshaber changed the title Don't cascade on reload [WIP] Don't cascade on reload Feb 9, 2016
@joshaber joshaber changed the title [WIP] Don't cascade on reload Don't cascade on reload Feb 9, 2016
@joshaber

joshaber commented Feb 9, 2016

Copy link
Copy Markdown
Contributor Author

@maxbrunsfeld and I talked about removing the initial window dimensions from the load settings entirely. I'ma go down that road and see how it works out.

@joshaber joshaber changed the title Don't cascade on reload [WIP] Don't cascade on reload Feb 9, 2016
@joshaber joshaber changed the title [WIP] Don't cascade on reload Don't cascade on reload Feb 9, 2016
@joshaber

joshaber commented Feb 9, 2016

Copy link
Copy Markdown
Contributor Author

So I went down the road of putting AtomWindow/AtomApplication in charge of dimensions, and found it to have some other catches:

  1. We store the default window dimensions in localStorage (
    dimensions = JSON.parse(localStorage.getItem("defaultWindowDimensions"))
    ). So the browser process can't get to it.
  2. At the same time, in order to cascade windows properly, we have to take into account other windows, which is what passing the dimensions in from AtomApplication gives us.

More generally it'd be really great to stop passing state between the browser and renderer using location, and would solve this, but that's more than I care to bite off for this PR.

@atom/core Any other thoughts? Are we OK with this as-is?

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Are we OK with this as-is?

👍

joshaber added a commit that referenced this pull request Feb 10, 2016
@joshaber
joshaber merged commit 99a7158 into master Feb 10, 2016
@joshaber
joshaber deleted the dont-cascade-on-reload branch February 10, 2016 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On reload, window cascades

2 participants