@@ -56,10 +56,10 @@ type State = {
5656 showScreenshot : boolean ,
5757} ;
5858
59- const getSSEUrl = ( id ?: string ) =>
59+ const getSSEUrl = ( id ?: string , initialPath ?: string = '' ) =>
6060 `https://${ id ? id + '.' : '' } sse.${
6161 process . env . NODE_ENV === 'development' ? 'codesandbox.io' : host ( )
62- } `;
62+ } ${ initialPath } `;
6363
6464const getDiff = ( a , b ) => {
6565 const diff = { } ;
@@ -171,7 +171,7 @@ class BasePreview extends React.Component<Props, State> {
171171 history : [ ] ,
172172 historyPosition : - 1 ,
173173 urlInAddressBar : this . serverPreview
174- ? getSSEUrl ( props . sandbox . id )
174+ ? getSSEUrl ( props . sandbox . id , props . initialPath )
175175 : frameUrl ( props . sandbox . id , props . initialPath || '' ) ,
176176 url : null ,
177177 overlayMessage : null ,
@@ -435,7 +435,7 @@ class BasePreview extends React.Component<Props, State> {
435435 resetState ( ) ;
436436
437437 const url = this . serverPreview
438- ? getSSEUrl ( newId )
438+ ? getSSEUrl ( newId , this . props . initialPath )
439439 : frameUrl ( newId , this . props . initialPath || '' ) ;
440440
441441 if ( this . serverPreview ) {
@@ -794,7 +794,7 @@ class BasePreview extends React.Component<Props, State> {
794794 sandbox = "allow-forms allow-scripts allow-same-origin allow-modals allow-popups allow-presentation"
795795 src = {
796796 this . serverPreview
797- ? getSSEUrl ( sandbox . id )
797+ ? getSSEUrl ( sandbox . id , this . initialPath )
798798 : frameUrl ( sandbox . id , this . initialPath )
799799 }
800800 id = "sandbox"
0 commit comments