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';
17
17
import { getTextOperation } from '@codesandbox/common/lib/utils/diff' ;
18
18
import { convertTypeToStatus } from '@codesandbox/common/lib/utils/notifications' ;
19
19
import { 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' ;
21
24
import { NotificationStatus } from '@codesandbox/notifications' ;
22
25
import {
23
26
Authorization ,
@@ -301,6 +304,17 @@ export const sandboxChanged = withLoadApp<{
301
304
const params = state . activeTeam ? { teamId : state . activeTeam } : undefined ;
302
305
const sandbox = await effects . api . getSandbox ( newId , params ) ;
303
306
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
+
304
318
actions . internal . setCurrentSandbox ( sandbox ) ;
305
319
} catch ( error ) {
306
320
const data = error . response ?. data ;
Original file line number Diff line number Diff line change @@ -405,6 +405,7 @@ export type Sandbox = {
405
405
alias : string | null ;
406
406
title : string | null ;
407
407
description : string ;
408
+ v2 : boolean ;
408
409
viewCount : number ;
409
410
likeCount : number ;
410
411
forkCount : number ;
You can’t perform that action at this time.
0 commit comments