Address Gadfly review: gofmt, memoize bed grid, unify clamp
Build image / build-and-push (push) Successful in 15s
Build image / build-and-push (push) Successful in 15s
- gofmt domain.go struct alignment. - Memoize the bed grid line arrays so a high-frequency plop drag doesn't rebuild them each pointermove. - Route the non-snapping placement/move paths through snapLocalToBedGrid with step 0 (pure clamp), removing the duplicated inline clamps in GardenCanvas.onPlace and PlopOverlay (drop the dead clampLocal helper). - Factor snapLocalToBedGrid's per-axis snap-and-clamp into one local fn. - Correct the gardenFromInput doc: grid size is defaulted from 0 on update. - Fix inconsistent indentation of the Inspector Notes field. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
This commit is contained in:
@@ -166,7 +166,9 @@ func (s *Service) DeleteGarden(ctx context.Context, actorID, gardenID int64) err
|
||||
|
||||
// gardenFromInput validates and normalizes input into a domain.Garden (without
|
||||
// identity/ownership fields). With applyDefaults, absent dimensions/unit are
|
||||
// filled in (create); without it, every field must be supplied (update).
|
||||
// filled in (create); without it, dimensions and unit must be supplied (update).
|
||||
// The grid size is the exception: 0 always means "unset" and is defaulted on both
|
||||
// paths, so an older client that omits it can't wipe the column to an invalid 0.
|
||||
func gardenFromInput(in GardenInput, applyDefaults bool) (*domain.Garden, error) {
|
||||
name := strings.TrimSpace(in.Name)
|
||||
if name == "" || len(name) > maxGardenNameLen {
|
||||
|
||||
Reference in New Issue
Block a user