web: warn when an opened drawing's name collides with an open tab

Web builds identify drawings by bare file name (the browser picker
exposes no real path), so two tabs with the same name also share the
single browser-stored copy: the last save silently replaces the other
tab's. Warn on open instead of letting that surface later.

(cherry picked from commit 6306359390)
This commit is contained in:
Afonsop authored and Hakan Seven committed 2026-10-12 12:02:04 +03:00
1 parent 4d1f9d5960
commit 8cce362009
1 file changed
+16
+16
View File
@@ -1868,6 +1868,22 @@ impl OpenCADStudio {
if self.opening.is_none() {
return Task::none();
}
// Web drawings live under bare file names: two tabs sharing a name
// also share the single browser-stored copy, and the last save
// silently replaces the other tab's. Warn at open time — the
// desktop identifies drawings by full path and needs no such check.
#[cfg(target_arch = "wasm32")]
if self.tab_showing(&path).is_some() {
self.command_line.push_warning(
crate::tf!(
"\"{}\" is already open in another tab. On the web both \
tabs share one stored copy — the last save overwrites \
the other.",
name
)
.as_ref(),
);
}
let open_started = self.opening.as_ref().map(|p| p.started);
let size_bytes = self
.opening