Skip to content

fix: show full geo name behavior on county maps#2706

Merged
adamdoe merged 1 commit intodevfrom
fix/csv-map-enhancement
Apr 8, 2026
Merged

fix: show full geo name behavior on county maps#2706
adamdoe merged 1 commit intodevfrom
fix/csv-map-enhancement

Conversation

@adamdoe
Copy link
Copy Markdown
Collaborator

@adamdoe adamdoe commented Apr 8, 2026

No description provided.

@adamdoe adamdoe requested review from Viseghoh and khartco as code owners April 8, 2026 15:24
Copilot AI review requested due to automatic review settings April 8, 2026 15:24
@adamdoe adamdoe merged commit 31ffade into dev Apr 8, 2026
@adamdoe adamdoe deleted the fix/csv-map-enhancement branch April 8, 2026 15:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the map DataTable CSV-export behavior so “FullGeoName” becomes truly toggle-driven (instead of implicitly forced for county maps), while preserving legacy county-map behavior via a 4.26.4 config migration.

Changes:

  • Add a 4.26.4 migration to enable table.showFullGeoNameInCSV for legacy us-county maps (including those embedded in dashboards).
  • Extract “add FullGeoName column” logic into a dedicated addOptionalFullGeoNameColumn helper and apply it from DataTable.
  • Add unit tests covering the helper behavior and the new migration behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/core/helpers/ver/4.26.4.ts Adds migration step to force-enable FullGeoName CSV export for legacy county maps.
packages/core/helpers/ver/tests/4.26.4.test.ts Adds tests validating migration behavior for map + dashboard cases.
packages/core/components/DataTable/helpers/addOptionalFullGeoNameColumn.ts New helper to conditionally add FullGeoName column to CSV export output.
packages/core/components/DataTable/helpers/tests/addOptionalFullGeoNameColumn.test.ts Adds vitest coverage for helper behavior across toggle on/off cases.
packages/core/components/DataTable/DataTable.tsx Replaces inline FullGeoName CSV logic with the new helper call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +31
if (!config?.table?.showFullGeoNameInCSV || typeof formatLegendLocation !== 'function') {
return csvDataUpdated
}

return csvDataUpdated.map((row, index) => {
const originalRow = csvData[index]
if (!originalRow) {
console.warn('Data mismatch: originalRow missing.', {
index,
csvDataLength: csvData.length,
csvDataUpdatedLength: csvDataUpdated.length
})
return row
}

return {
FullGeoName: formatLegendLocation(originalRow[config.columns.geo.name]),
...row
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addOptionalFullGeoNameColumn can throw if config.columns, config.columns.geo, or config.columns.geo.name is missing while table.showFullGeoNameInCSV is true (e.g., partially-migrated/hand-edited configs). Consider defensively checking for the geo column name (and the corresponding value on originalRow) and returning csvDataUpdated/row when unavailable to avoid runtime crashes during CSV export.

Copilot uses AI. Check for mistakes.
config: any
csvData: Record<string, any>[]
csvDataUpdated: Record<string, any>[]
formatLegendLocation?: (key: string) => string
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatLegendLocation type here is (key: string) => string, but DataTableProps.formatLegendLocation is typed as (row: string, runtimeLookup: string) => string. To keep types consistent and avoid subtle TS assignability issues, consider reusing the prop type (e.g., DataTableProps['formatLegendLocation']) or updating this signature to accept the optional second parameter.

Suggested change
formatLegendLocation?: (key: string) => string
formatLegendLocation?: (key: string, runtimeLookup?: string) => string

Copilot uses AI. Check for mistakes.
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