Skip to content

Commit fe8dba0

Browse files
committed
fix(fork): toast on failure, disabled opacity, copy previewYaml/planArtifact/config
1 parent c303d40 commit fe8dba0

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

apps/sim/app/api/mothership/chats/[chatId]/fork/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ export const POST = withRouteHandler(
8888
model: parent.model,
8989
messages: forkedMessages,
9090
resources: parentResources,
91+
previewYaml: parent.previewYaml,
92+
planArtifact: parent.planArtifact,
93+
config: parent.config,
9194
conversationId: null,
9295
updatedAt: now,
9396
lastSeenAt: now,

apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import {
1616
ThumbsDown,
1717
ThumbsUp,
1818
Tooltip,
19+
toast,
1920
} from '@/components/emcn'
21+
import { cn } from '@/lib/core/utils/cn'
2022
import { useSubmitCopilotFeedback } from '@/hooks/queries/copilot-feedback'
2123
import { useForkTask } from '@/hooks/queries/tasks'
2224

@@ -154,7 +156,7 @@ export const MessageActions = memo(function MessageActions({
154156
const result = await forkTask.mutateAsync({ chatId, upToMessageId: messageId })
155157
router.push(`/workspace/${params.workspaceId}/task/${result.id}`)
156158
} catch {
157-
/* fork failed — button resets, user can retry */
159+
toast.error('Failed to fork chat')
158160
}
159161
}
160162

@@ -221,7 +223,7 @@ export const MessageActions = memo(function MessageActions({
221223
aria-label='Fork from here'
222224
onClick={handleFork}
223225
disabled={forkTask.isPending}
224-
className={BUTTON_CLASS}
226+
className={cn(BUTTON_CLASS, forkTask.isPending && 'cursor-not-allowed opacity-50')}
225227
>
226228
<GitBranch className={ICON_CLASS} />
227229
</button>

0 commit comments

Comments
 (0)