File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
components/dashboard/src/workspaces Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,20 @@ export function CreateWorkspacePage() {
6666 ) ;
6767 const workspaceContext = useWorkspaceContext ( contextURL ) ;
6868 const isLoading = workspaceContext . isLoading || projects . isLoading ;
69+
70+ // see if we have a matching project based on context url and project's repo url
6971 const project = useMemo ( ( ) => {
7072 if ( ! workspaceContext . data || ! projects . data ) {
7173 return undefined ;
7274 }
73- const cloneUrl = ( workspaceContext . data as CommitContext ) . repository . cloneUrl ;
74- return projects . data . projects . find ( ( p ) => p . cloneUrl === cloneUrl ) ;
75+ if ( "repository" in workspaceContext . data ) {
76+ const cloneUrl = ( workspaceContext . data as CommitContext ) ?. repository ?. cloneUrl ;
77+ if ( ! cloneUrl ) {
78+ return ;
79+ }
80+
81+ return projects . data . projects . find ( ( p ) => p . cloneUrl === cloneUrl ) ;
82+ }
7583 } , [ projects . data , workspaceContext . data ] ) ;
7684
7785 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments