-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
feat: added the "Open Preview in a New Tab" #1101
base: main
Are you sure you want to change the base?
Conversation
Stijnus
commented
Jan 15, 2025
is this ready? |
I did my testing on my end but Yes it should be ready but please to be sure test before you merge it. thx, Br, |
Nice on. works fine for me so far. Just one thing, but not a must => if the external preview is open, can we prevent from switching to the preview tab within the main ui? So stay on code editor. |
like a detach window function or how i need to interper it ? can you be more precise? |
I was thinking about it, i don't think there is any way to communicate between these two tabs. so don't know how this is possible. I suggest we merge this PR and open a separate PR to explore this concept. |
ì was playing arround this today after the PR : The fundamental issue is that the web app running inside the WebContainer iframe has its own isolated context, regardless of whether it uses localStorage or not. Here's what's happening:
The current approach of trying to sync through the parent window's localStorage or broadcast channels won't work because:
Possible solutions could be:
|
thanks for investigating and summarizing this. I just saw it works the same in bolt.new, so I assume this is correct what you found out. @patak-dev but maybe you want to change/enhance this as well for bolt.new, then we can use it as well :P |
Makes sense @leex279, thanks for the heads up! |
@Stijnus sli.dev, a browser based presentation tool also uses BroadcastChannels for communicating changes across tabs and even windows and it's a very robust and responsive experience. Would it not be possible to have a thin shell around the webcontainer which listens to the broadcast and then propagates to the webcontainer? Or is this what you meant with "Set up a message passing system between the WebContainer and parent" |