Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not destroy PIO Home when tab editor is changed #32

Closed
ivankravets opened this issue Aug 9, 2017 · 6 comments
Closed

Do not destroy PIO Home when tab editor is changed #32

ivankravets opened this issue Aug 9, 2017 · 6 comments

Comments

@ivankravets
Copy link
Member

ivankravets commented Aug 9, 2017

Temporary solution

Please open PIO Home in a separate layout (Split Editor and drag PIO Home tab to a new tab pane). See | | | icon in the top right corner.


Currently, VSCode totally destroys PIO Home when a user changes tab. Need to find a way how to restore previous IFRAME state.

There is no information here:

/cc @dbaeumer @Tyriar should I open a feature request? Related source code.

screen shot 2017-08-10 at 01 52 05

@Tyriar
Copy link

Tyriar commented Aug 10, 2017

@mjbvz might know

@ivankravets
Copy link
Member Author

@mjbvz do you have any ideas?

@mjbvz
Copy link

mjbvz commented Aug 17, 2017

Yes, we destroy the html preview whenever the user switches away from it. This is by design.

The proper approach is write the html preview so that it can save its state and then recreate itself from this state. I believe the state needs to be saved by the extension code itself. Setting cookies in the webview doesn't work and I don't think local storage will either, but I'd have to check this.

For an example of this, take a look at the markdown extension: https://github.com/Microsoft/vscode/blob/master/extensions/markdown/media/main.js It doesn't really persist any state but it does set the initial view position using vscode-markdown-preview-data and it sends data back to vscode using window.parent.postMessage

@ivankravets
Copy link
Member Author

The problem here that our HTML Preview is a complex Web application which depends on the backend server. We need 1-2 secs to establish a connection.

2-nd problem, we don't render HTML content on-the-fly as Markdown does. Yes, in your case you can control these things. We have a pre-built Web application based on Rect components. That is a very expensive operation for us to "refresh" application.

Finally, if we have active session between Web-previewed APP and our backend (for example, physical USB Serial Monitor), we can't keep this session when a user switches between tabs.

In any case, thanks a lot for the info.

@ivankravets
Copy link
Member Author

Depends on microsoft/vscode#28263

@ivankravets
Copy link
Member Author

@mjbvz thank you so much for this API! 😊

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

No branches or pull requests

3 participants