Skip to content

Commit c095f99

Browse files
dfallingclaude
andauthored
Allow saving elements without a URL (#33)
The URL field is optional, but canSave required a valid URL, so an element with no URL could never be saved. Permit an empty URL while still rejecting a non-empty invalid one. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ad41a4a commit c095f99

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/map/ElementEditScreen.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ function EditForm({element, onDone}: {element: Element; onDone: () => void}) {
8282
const uriError =
8383
trimmedUri.length > 0 && !uriValid ? 'Enter a valid URL.' : null;
8484

85-
const canSave = name.trim().length > 0 && uriValid && !saving && !uploading;
85+
const canSave =
86+
name.trim().length > 0 &&
87+
(trimmedUri.length === 0 || uriValid) &&
88+
!saving &&
89+
!uploading;
8690

8791
async function onAddPhoto() {
8892
setErrorMessage(null);

0 commit comments

Comments
 (0)