@@ -295,8 +295,10 @@ export default function ProjectModals({
295295
296296 /**
297297 * Overwrites an existing project with the current draft: writes the draft's analysis into the
298- * chosen project, makes it the active Save target, and clears the dirty flag. The backend
299- * surfaces its own error notification; here we only log.
298+ * chosen project, reconciles the project's declared config (analysis languages / alignment
299+ * target) with the draft so the metadata matches the glosses now stored in it, makes it the
300+ * active Save target, and clears the dirty flag. The backend surfaces its own error notification;
301+ * here we only log.
300302 *
301303 * @param project - The existing project to overwrite.
302304 * @returns A promise that resolves once the overwrite completes or the failure has been handled.
@@ -312,7 +314,25 @@ export default function ProjectModals({
312314 project . id ,
313315 JSON . stringify ( snapshot . analysis ) ,
314316 ) ;
315- setActiveProject ( project ) ;
317+ // Push the draft's analysis languages / alignment target onto the project so its declared
318+ // metadata stays consistent with the glosses just written (mirroring how Save As → New
319+ // carries the draft's config into the created project). The project's name and description
320+ // are intentionally preserved — overwriting keeps the target's identity.
321+ await papi . commands . sendCommand (
322+ 'interlinearizer.updateProjectMetadata' ,
323+ project . id ,
324+ project . name ,
325+ project . description ,
326+ snapshot . analysisLanguages ,
327+ snapshot . targetProjectId ,
328+ ) ;
329+ setActiveProject ( {
330+ ...project ,
331+ analysisLanguages : snapshot . analysisLanguages ,
332+ // Assign explicitly (rather than a conditional spread) so a target binding on the
333+ // overwritten project is cleared when the draft has none, matching what was persisted.
334+ targetProjectId : snapshot . targetProjectId ,
335+ } ) ;
316336 markSynced ( snapshot . analysis ) ;
317337 setModal ( 'none' ) ;
318338 } catch ( e ) {
0 commit comments