Open wusuopu opened 6 years ago
Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.
This is a bug unfortunately - we should definitely be persisting it. It's painful if you switch tabs and don't realize it! The problem is that, in our current implementation, the browser 'lifecycle' is tied to our webview
that we render. We might need to hold onto the webview and manage its lifecycle outside the react component lifecycle (so even though the component that hosts the webview is hidden and gets re-rendered, we'd use the same webview
tag instance)
A possible solution maybe can resolve this problem.
To create and save webview
instance in redux store.When the BrowserView
component will mont, fetch the webview
from redux store, and append to BrowserViewWrapper
. And when theBrowserView
component will unmount, remove then webview
from BrowserViewWrapper
.
To subscribe buffer event. When a buffer deleted, then delete the webview
instance from redux store.
Oni Version: 0.3.4 Neovim Version (Linux only): Operating System: macOS 10.13.4
Describe your issue
I have open a browser tab and a file editor tab. But i switch to another tab then swtich to browser tab again. The webview will reload.![slice 1](https://user-images.githubusercontent.com/1478284/41165162-88a8a92e-6b6f-11e8-8795-eea92b70c0ca.png)
I guess maybe when switch to another tab, this webview instance has been destroyed. The switch to the browser tab next time, it will create a new webview instance. So it will reload page.
So how to prevent destroies the webview instance, and make it reusable in next time.
Expected behaviour
The webview will keep last status.
Actual behaviour
It will refresh.
Steps to reproduce
Open two tabs, one is browser tab. switch between these tabs. When swtich to browse tab, you will see the webview reload page.