File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
app/src/app/overmind/namespaces/editor Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ import { isAbsoluteVersion } from '@codesandbox/common/lib/utils/dependencies';
1717import { getTextOperation } from '@codesandbox/common/lib/utils/diff' ;
1818import { convertTypeToStatus } from '@codesandbox/common/lib/utils/notifications' ;
1919import { hasPermission } from '@codesandbox/common/lib/utils/permission' ;
20- import { signInPageUrl } from '@codesandbox/common/lib/utils/url-generator' ;
20+ import {
21+ sandboxUrl ,
22+ signInPageUrl ,
23+ } from '@codesandbox/common/lib/utils/url-generator' ;
2124import { NotificationStatus } from '@codesandbox/notifications' ;
2225import {
2326 Authorization ,
@@ -301,6 +304,17 @@ export const sandboxChanged = withLoadApp<{
301304 const params = state . activeTeam ? { teamId : state . activeTeam } : undefined ;
302305 const sandbox = await effects . api . getSandbox ( newId , params ) ;
303306
307+ // Failsafe, in case someone types in the URL to load a v2 sandbox in v1
308+ if ( sandbox . v2 ) {
309+ const sandboxV2Url = sandboxUrl ( {
310+ id : sandbox . id ,
311+ alias : sandbox . alias ,
312+ isV2 : true ,
313+ } ) ;
314+
315+ window . location . href = sandboxV2Url ;
316+ }
317+
304318 actions . internal . setCurrentSandbox ( sandbox ) ;
305319 } catch ( error ) {
306320 const data = error . response ?. data ;
Original file line number Diff line number Diff line change @@ -405,6 +405,7 @@ export type Sandbox = {
405405 alias : string | null ;
406406 title : string | null ;
407407 description : string ;
408+ v2 : boolean ;
408409 viewCount : number ;
409410 likeCount : number ;
410411 forkCount : number ;
You can’t perform that action at this time.
0 commit comments