Commit 2d5bac75e0

2d5bac75e007abe4e79119d200b9755d3ba03b03

parent: c47b1e6e6c

Unsigned

cmc <hello@cleberg.net> · 2026-07-16 00:25 UTC

fix: allow clearing a repository description

metadataInputForSave assigned nil through the dictionary subscript to clear a
description. Swift removes the key on a nil subscript assignment, so the
mutation was sent with no `description` field and the old value survived —
clearing a description silently did nothing.

Store the nil with updateValue so the key is retained; AnyCodable already
encodes an unmatched value as a JSON null.

Layout: unified · split

Hutch/Views/Repositories/RepositorySettingsViewModel.swift +8 −1
@@ -301,7 +301,14 @@ final class RepositorySettingsViewModel {
301 } 301 }
302 302
303 if normalizedEditedDescription != (repository.description ?? "") { 303 if normalizedEditedDescription != (repository.description ?? "") {
304 input["description"] = normalizedEditedDescription.isEmpty ? Optional<String>.none as String? : normalizedEditedDescription 304 if normalizedEditedDescription.isEmpty {
305 // Assigning nil through the subscript would remove the key and omit
306 // `description` from the mutation, leaving the old value in place.
307 // updateValue stores an explicit nil, which AnyCodable encodes as null.
308 input.updateValue(Optional<String>.none as any Sendable, forKey: "description")
309 } else {
310 input["description"] = normalizedEditedDescription
311 }
305 } 312 }
306 313
307 return input 314 return input