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 11import React from 'react' ;
22import { TemplateFragment } from 'app/graphql/types' ;
33import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
4+ import getTemplateDefinition from '@codesandbox/common/lib/templates' ;
45import { useOvermind } from 'app/overmind' ;
56import { useKey } from 'react-use' ;
67import { isMac } from '@codesandbox/common/lib/utils/platform' ;
@@ -43,15 +44,19 @@ export const TemplateList = ({
4344 showSecondaryShortcuts,
4445 columnCount = 2 ,
4546} : ITemplateListProps ) => {
46- const { actions } = useOvermind ( ) ;
47+ const { actions, state } = useOvermind ( ) ;
4748 const [ focusedTemplateIndex , setFocusedTemplate ] = React . useState ( 0 ) ;
4849 const lastMouseMoveEventAt = React . useRef < number > ( Date . now ( ) ) ;
4950
5051 const openSandbox = (
5152 sandbox : TemplateFragment [ 'sandbox' ] ,
5253 openInNewWindow = false
5354 ) => {
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 ) {
5560 actions . editor . forkExternalSandbox ( {
5661 sandboxId : sandbox . id ,
5762 openInNewWindow,
You can’t perform that action at this time.
0 commit comments