Skip to content

Commit 4aa71a9

Browse files
backnotpropclaude
andcommitted
fix: add imageBaseDir state for linked doc base resolution
The handleOpenLinkedDoc callback references imageBaseDir as a fallback for first-hop relative path resolution, but the state variable and its wiring from the /api/plan response were missing on this branch (they exist on main via #260). Add them here so the branch works standalone and merges cleanly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 60daf80 commit 4aa71a9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/editor/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ const App: React.FC = () => {
393393
const [origin, setOrigin] = useState<'claude-code' | 'opencode' | 'pi' | null>(null);
394394
const [globalAttachments, setGlobalAttachments] = useState<ImageAttachment[]>([]);
395395
const [annotateMode, setAnnotateMode] = useState(false);
396+
const [imageBaseDir, setImageBaseDir] = useState<string | undefined>(undefined);
396397
const [isLoading, setIsLoading] = useState(true);
397398
const [isSubmitting, setIsSubmitting] = useState(false);
398399
const [submitted, setSubmitted] = useState<'approved' | 'denied' | null>(null);
@@ -634,12 +635,15 @@ const App: React.FC = () => {
634635
if (!res.ok) throw new Error('Not in API mode');
635636
return res.json();
636637
})
637-
.then((data: { plan: string; origin?: 'claude-code' | 'opencode' | 'pi'; mode?: 'annotate'; sharingEnabled?: boolean; shareBaseUrl?: string; pasteApiUrl?: string; repoInfo?: { display: string; branch?: string }; previousPlan?: string | null; versionInfo?: { version: number; totalVersions: number; project: string } }) => {
638+
.then((data: { plan: string; origin?: 'claude-code' | 'opencode' | 'pi'; mode?: 'annotate'; filePath?: string; sharingEnabled?: boolean; shareBaseUrl?: string; pasteApiUrl?: string; repoInfo?: { display: string; branch?: string }; previousPlan?: string | null; versionInfo?: { version: number; totalVersions: number; project: string } }) => {
638639
if (data.plan) setMarkdown(data.plan);
639640
setIsApiMode(true);
640641
if (data.mode === 'annotate') {
641642
setAnnotateMode(true);
642643
}
644+
if (data.filePath) {
645+
setImageBaseDir(data.filePath.replace(/\/[^/]+$/, ''));
646+
}
643647
if (data.sharingEnabled !== undefined) {
644648
setSharingEnabled(data.sharingEnabled);
645649
}

0 commit comments

Comments
 (0)