File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/app/src/app/components/CreateNewSandbox/CreateSandbox/TemplateList Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { TemplateFragment } from 'app/graphql/types' ;
3
3
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
4
+ import getTemplateDefinition from '@codesandbox/common/lib/templates' ;
4
5
import { useOvermind } from 'app/overmind' ;
5
6
import { useKey } from 'react-use' ;
6
7
import { isMac } from '@codesandbox/common/lib/utils/platform' ;
@@ -43,15 +44,19 @@ export const TemplateList = ({
43
44
showSecondaryShortcuts,
44
45
columnCount = 2 ,
45
46
} : ITemplateListProps ) => {
46
- const { actions } = useOvermind ( ) ;
47
+ const { actions, state } = useOvermind ( ) ;
47
48
const [ focusedTemplateIndex , setFocusedTemplate ] = React . useState ( 0 ) ;
48
49
const lastMouseMoveEventAt = React . useRef < number > ( Date . now ( ) ) ;
49
50
50
51
const openSandbox = (
51
52
sandbox : TemplateFragment [ 'sandbox' ] ,
52
53
openInNewWindow = false
53
54
) => {
54
- if ( forkOnOpen ) {
55
+ // We can't fork a sandbox that's server and if you're signed in, so then we just go to it
56
+ const templateDefinition = getTemplateDefinition ( sandbox . source . template ) ;
57
+ const cannotFork = templateDefinition . isServer && ! state . isLoggedIn ;
58
+
59
+ if ( forkOnOpen && ! cannotFork ) {
55
60
actions . editor . forkExternalSandbox ( {
56
61
sandboxId : sandbox . id ,
57
62
openInNewWindow,
You can’t perform that action at this time.
0 commit comments