Skip to content

Commit 7f6bb8b

Browse files
Merge branch 'fix-the-save-button-in-the-repository-detail-view-pv1a'
2 parents b5fa8ba + 66d33bf commit 7f6bb8b

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/routes/repositories/$repoId.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import {
2525
VisualStudioCodeIcon,
2626
TaskAdd01Icon,
2727
ComputerTerminal01Icon,
28-
Add02Icon,
28+
Tick02Icon,
2929
GridViewIcon,
3030
} from '@hugeicons/core-free-icons'
31+
import { toast } from 'sonner'
3132
import { Checkbox } from '@/components/ui/checkbox'
3233
import { useEditorApp, useEditorHost, useEditorSshPort } from '@/hooks/use-config'
3334
import { useOpenInTerminal } from '@/hooks/use-open-in-terminal'
@@ -82,15 +83,28 @@ function RepositoryDetailView() {
8283
const handleSave = () => {
8384
if (!repository) return
8485

85-
updateRepository.mutate({
86-
id: repository.id,
87-
updates: {
88-
displayName: displayName.trim() || repository.path.split('/').pop() || 'repo',
89-
startupScript: startupScript.trim() || null,
90-
copyFiles: copyFiles.trim() || null,
91-
isCopierTemplate,
86+
updateRepository.mutate(
87+
{
88+
id: repository.id,
89+
updates: {
90+
displayName: displayName.trim() || repository.path.split('/').pop() || 'repo',
91+
startupScript: startupScript.trim() || null,
92+
copyFiles: copyFiles.trim() || null,
93+
isCopierTemplate,
94+
},
9295
},
93-
})
96+
{
97+
onSuccess: () => {
98+
toast.success('Repository saved')
99+
setHasChanges(false)
100+
},
101+
onError: (error) => {
102+
toast.error('Failed to save repository', {
103+
description: error instanceof Error ? error.message : 'Unknown error',
104+
})
105+
},
106+
}
107+
)
94108
}
95109

96110
const handleDelete = async () => {
@@ -226,7 +240,7 @@ function RepositoryDetailView() {
226240
onClick={handleSave}
227241
disabled={!hasChanges || updateRepository.isPending}
228242
>
229-
<HugeiconsIcon icon={Add02Icon} size={14} strokeWidth={2} data-slot="icon" />
243+
<HugeiconsIcon icon={Tick02Icon} size={14} strokeWidth={2} data-slot="icon" />
230244
<span className="max-sm:hidden">{updateRepository.isPending ? 'Saving...' : 'Save'}</span>
231245
</Button>
232246
</div>

0 commit comments

Comments
 (0)