Skip to content

Conversation

mishushakov
Copy link
Member

@mishushakov mishushakov commented Sep 29, 2025

Note

Memoizes key selectors and introduces an independently toggleable preview sidebar, updating API selection, message updates, and layout accordingly.

  • UI/UX:
    • Preview sidebar made independently toggleable via isSideBarOpen; open on submit/preview, close via button; layout switches between md:grid-cols-1 and md:grid-cols-2.
    • Preview now renders based on isSideBarOpen (not fragment), replacing onClose with isSideBarOpen and setIsSideBarOpen.
  • State & Performance:
    • Memoized filteredModels, currentModel, lastMessage, currentTemplate, shouldUseMorph, and apiEndpoint using useMemo.
    • Added setLastMessage (useCallback) and removed setMessage, updating assistant message/result updates accordingly.
  • Behavior:
    • Simplified morph usage: shouldUseMorph now checks only fragment; conditional payload spread updated to ...(shouldUseMorph ? { currentFragment: fragment } : {}).
    • Always opens sidebar when submitting or setting current preview.

Written by Cursor Bugbot for commit a66a4ff. This will update automatically on new commits. Configure here.

Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
fragments Ready Ready Preview Comment Sep 29, 2025 7:39pm

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Morph API Data Validation Regression

The shouldUseMorph condition was simplified, no longer validating for fragment.code and fragment.file_path. This could cause the morph API to receive incomplete fragment data, potentially leading to API errors or unexpected behavior.

app/page.tsx#L100-L104

fragments/app/page.tsx

Lines 100 to 104 in a66a4ff

// Determine which API to use based on morph toggle and existing fragment
const shouldUseMorph = useMemo(
() => useMorphApply && fragment,
[useMorphApply, fragment],
)

Fix in Cursor Fix in Web


Bug: Undo Operation Triggers Unwanted Sidebar Display

The handleUndo function clears the displayed fragment and result by calling setCurrentPreview. However, setCurrentPreview now always opens the sidebar, which results in an empty sidebar being visible after an undo operation, creating a confusing user experience.

app/page.tsx#L293-L297

fragments/app/page.tsx

Lines 293 to 297 in a66a4ff

function handleUndo() {
setMessages((previousMessages) => [...previousMessages.slice(0, -2)])
setCurrentPreview({ fragment: undefined, result: undefined })
}

Fix in Cursor Fix in Web


@mishushakov mishushakov marked this pull request as draft September 29, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants