Skip to content

Commit 179d7f9

Browse files
Fix GitHub commit (codesandbox#3553)
1 parent 249b458 commit 179d7f9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/Git/Git.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { WorkspaceInputContainer, WorkspaceSubtitle } from '../../../elements';
1212
import { Container, Buttons, ErrorMessage, NoChanges } from './elements';
1313
import { TotalChanges } from './TotalChanges';
1414

15-
const hasWriteAccess = (rights: string) => ['admin', 'write'].includes(rights);
15+
const hasWriteAccess = (rights: string = '') =>
16+
['admin', 'write'].includes(rights);
1617

1718
export const Git: FunctionComponent = () => {
1819
const {
@@ -115,7 +116,7 @@ export const Git: FunctionComponent = () => {
115116
</WorkspaceInputContainer>
116117

117118
<Buttons>
118-
{hasWriteAccess(gitChanges.rights) && (
119+
{hasWriteAccess(gitChanges?.rights) && (
119120
<Button
120121
block
121122
disabled={!subject || modulesNotSaved}

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/GitHub/CommitForm.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export const CommitForm = () => {
2121
},
2222
state: {
2323
editor: { isAllModulesSynced },
24-
git: { description, originalGitChanges: gitChanges, subject },
24+
git: { description, originalGitChanges, subject },
2525
},
2626
} = useOvermind();
2727

28-
const hasWriteAccess = (rights: string) =>
28+
const hasWriteAccess = (rights: string = '') =>
2929
['admin', 'write'].includes(rights);
3030

3131
const modulesNotSaved = !isAllModulesSynced;
@@ -59,7 +59,7 @@ export const CommitForm = () => {
5959
/>
6060
</FormField>
6161
<Stack gap={2}>
62-
{hasWriteAccess(gitChanges.rights) && (
62+
{hasWriteAccess(originalGitChanges?.rights) && (
6363
<Button
6464
variant="secondary"
6565
disabled={!subject || modulesNotSaved}

0 commit comments

Comments
 (0)