Skip to content

Comments

Fix locality age method persistence and scoped validation#1060

Merged
karilint merged 1 commit intocodex/create-feature-implementation-planfrom
copilot/sub-pr-1059
Feb 16, 2026
Merged

Fix locality age method persistence and scoped validation#1060
karilint merged 1 commit intocodex/create-feature-implementation-planfrom
copilot/sub-pr-1059

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Switching between dating methods (Time unit, Absolute, Composite) in the Locality Age tab was clearing previously entered age values, forcing users to re-enter data when exploring different dating approaches.

Changes

  • Age draft persistence: AgeTab now maintains method-specific state (ageDraftsByMethod) that preserves min_age, max_age, and basis field selections per dating method. Switching methods saves current values and restores previously entered values for the target method.

  • Scoped validation: Validation logic refactored to evaluate required basis fields only against the active dating method. For composite mode, validation enforces that one row uses time_unit basis while the other uses absolute basis, determined by which fields are populated.

  • Test coverage: Added regression tests for method round-trip scenarios and fraction-based age recalculation.

Example

// Before: switching methods cleared all age values
// After: preserved per-method in ageDraftsByMethod state
const handleDateMethChange = (value: LocalityDatingMethod) => {
  const nextDrafts = { ...ageDraftsByMethod }
  
  // Save current values before switch
  if (currentDateMethod) {
    nextDrafts[currentDateMethod] = getAgeFields(editData)
  }
  
  // Restore saved values for target method
  const restoredFields = nextDrafts[nextDateMethod] ?? emptyAgeFields()
  setEditData({ ...editData, date_meth: nextDateMethod, ...restoredFields })
}

Documentation

Updated README.md and CHANGELOG.md with reviewer notes on the persistence behavior and validation scoping.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix unexpected error in generated pull request Fix locality age method persistence and scoped validation Feb 16, 2026
Copilot AI requested a review from karilint February 16, 2026 15:45
@karilint karilint marked this pull request as ready for review February 16, 2026 15:56
@karilint karilint merged commit 689c312 into codex/create-feature-implementation-plan Feb 16, 2026
1 check passed
@karilint karilint deleted the copilot/sub-pr-1059 branch February 16, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants