akonwi / git-plus

vim-fugitive like package for atom. make commits and other git things without the terminal
MIT License
537 stars 163 forks source link

WIP: Fixes #787 not to restore output view when without serialized view #790

Closed aviatesk closed 5 years ago

aviatesk commented 5 years ago

In this PR, I'm trying to address the problem proposed in #787.

What's wrong

So far, I confirmed that when there is a previously serialized view, deserializedOutputView works fine and restores the view into the location where it located.

But even when the view had been destroyed, activate function still creates a new OutputViewContainer object anyway, and the pane is even toggled because it's defined in the constructor, which makes this problem.

Workaround

I deleted the line in activate function and the annoying restoring seems disappeared 👇

Why WIP ? (Remaining work)

The remaining problem now is that when we don't have a restored output view and then call git-plus:run, we have to manually create the view by invoking git-plus:toggle-output-view in order to see the result, since there is no view yet.

I think it's better to create (and toggle) the view when we first call git-plus:run by checking if there is an already existing view. But I'm not sure git-plus:run is the only user command which uses OutputViewComponent, thus I leave this PR WIP.

So, could you tell me all the cases when we use OutputViewComponent ?? Or does this workaround seem inappropriate this time ?

akonwi commented 5 years ago

Thanks for getting started on this. I ended up making the changes myself and implementing a ViewController that can create the view only when it's requested. Feel free to take a look at the commit to see how it was working before.

aviatesk commented 5 years ago

Thanks for your work !