Skip to content

Commit 12c4eb1

Browse files
backnotpropclaude
andcommitted
fix: preserve normal annotations across diff toggle
Replace ternary rendering with display:none so the Viewer stays mounted and web-highlighter DOM marks survive the toggle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1187586 commit 12c4eb1

1 file changed

Lines changed: 30 additions & 28 deletions

File tree

packages/editor/App.tsx

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,37 +1244,39 @@ const App: React.FC = () => {
12441244
/>
12451245
<div className="min-h-full flex flex-col items-center px-2 py-3 md:px-10 md:py-8 xl:px-16">
12461246
{/* Annotation Toolstrip */}
1247-
{(
1248-
<div className="w-full mb-3 md:mb-4 flex items-center justify-start" style={{ maxWidth: planMaxWidth }}>
1249-
<AnnotationToolstrip
1250-
inputMethod={inputMethod}
1251-
onInputMethodChange={handleInputMethodChange}
1247+
<div className="w-full mb-3 md:mb-4 flex items-center justify-start" style={{ maxWidth: planMaxWidth }}>
1248+
<AnnotationToolstrip
1249+
inputMethod={inputMethod}
1250+
onInputMethodChange={handleInputMethodChange}
1251+
mode={editorMode}
1252+
onModeChange={handleEditorModeChange}
1253+
taterMode={taterMode}
1254+
/>
1255+
</div>
1256+
1257+
{/* Plan Diff View — rendered when diff data exists, hidden when inactive */}
1258+
{planDiff.diffBlocks && planDiff.diffStats && (
1259+
<div className="w-full flex justify-center" style={{ display: isPlanDiffActive ? undefined : 'none' }}>
1260+
<PlanDiffViewer
1261+
diffBlocks={planDiff.diffBlocks}
1262+
diffStats={planDiff.diffStats}
1263+
diffMode={planDiffMode}
1264+
onDiffModeChange={setPlanDiffMode}
1265+
onPlanDiffToggle={() => setIsPlanDiffActive(false)}
1266+
repoInfo={repoInfo}
1267+
baseVersionLabel={planDiff.diffBaseVersion != null ? `v${planDiff.diffBaseVersion}` : undefined}
1268+
baseVersion={planDiff.diffBaseVersion ?? undefined}
1269+
maxWidth={planMaxWidth}
1270+
annotations={diffAnnotations}
1271+
onAddAnnotation={handleAddAnnotation}
1272+
onSelectAnnotation={handleSelectAnnotation}
1273+
selectedAnnotationId={selectedAnnotationId}
12521274
mode={editorMode}
1253-
onModeChange={handleEditorModeChange}
1254-
taterMode={taterMode}
12551275
/>
12561276
</div>
12571277
)}
1258-
1259-
{/* Plan Diff View or Normal Plan View */}
1260-
{isPlanDiffActive && planDiff.diffBlocks && planDiff.diffStats ? (
1261-
<PlanDiffViewer
1262-
diffBlocks={planDiff.diffBlocks}
1263-
diffStats={planDiff.diffStats}
1264-
diffMode={planDiffMode}
1265-
onDiffModeChange={setPlanDiffMode}
1266-
onPlanDiffToggle={() => setIsPlanDiffActive(false)}
1267-
repoInfo={repoInfo}
1268-
baseVersionLabel={planDiff.diffBaseVersion != null ? `v${planDiff.diffBaseVersion}` : undefined}
1269-
baseVersion={planDiff.diffBaseVersion ?? undefined}
1270-
maxWidth={planMaxWidth}
1271-
annotations={diffAnnotations}
1272-
onAddAnnotation={handleAddAnnotation}
1273-
onSelectAnnotation={handleSelectAnnotation}
1274-
selectedAnnotationId={selectedAnnotationId}
1275-
mode={editorMode}
1276-
/>
1277-
) : (
1278+
{/* Normal Plan View — always mounted, hidden during diff mode */}
1279+
<div className="w-full flex justify-center" style={{ display: isPlanDiffActive && planDiff.diffBlocks ? 'none' : undefined }}>
12781280
<Viewer
12791281
key={linkedDocHook.isActive ? `doc:${linkedDocHook.filepath}` : 'plan'}
12801282
ref={viewerRef}
@@ -1303,7 +1305,7 @@ const App: React.FC = () => {
13031305
linkedDocInfo={linkedDocHook.isActive ? { filepath: linkedDocHook.filepath!, onBack: handleLinkedDocBack, label: vaultBrowser.activeFile ? 'Vault File' : undefined } : null}
13041306
imageBaseDir={imageBaseDir}
13051307
/>
1306-
)}
1308+
</div>
13071309
</div>
13081310
</main>
13091311

0 commit comments

Comments
 (0)