Skip to content

fix: minor bugs for mapped for funders demo#306

Merged
joaquimds merged 2 commits intomainfrom
fix/mapped-for-funders-fixes
Feb 5, 2026
Merged

fix: minor bugs for mapped for funders demo#306
joaquimds merged 2 commits intomainfrom
fix/mapped-for-funders-fixes

Conversation

@joaquimds
Copy link
Member

No description provided.

Copy link
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

This PR fixes several minor bugs for the "funders demo" in a mapping application. The changes include refactoring a display value formatting function, fixing UI conditional rendering logic, and improving user-facing labels.

Changes:

  • Created a centralized getDisplayValue utility function in utils/stats.ts to format values for display (numbers, percentages, etc.)
  • Fixed conditional rendering of the style section in VisualisationPanel to hide when secondary column is selected (bivariate mode)
  • Modified fill color logic to add null-safety check for feature-state values
  • Updated labels in ColumnRoleFields to clarify optional fields

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/map/[id]/utils/stats.ts New utility function for formatting display values with percentage detection
src/app/map/[id]/components/inspector/BoundaryDataPanel.tsx Updated to use new getDisplayValue function with column definitions
src/app/map/[id]/components/controls/VisualisationPanel/VisualisationPanel.tsx Added conditional rendering to hide style section in bivariate mode
src/app/map/[id]/components/Choropleth/useChoroplethColors.ts Modified cleanup logic in feature state effect
src/app/map/[id]/components/Choropleth/index.tsx Minor formatting change (blank line)
src/app/map/[id]/components/BoundaryHoverInfo/utils.ts Removed getDisplayValue function (moved to stats.ts)
src/app/map/[id]/components/BoundaryHoverInfo/AreasList.tsx Updated to use new getDisplayValue from stats.ts
src/app/map/[id]/colors.ts Added null-safety wrapper for fill color expression
src/app/(private)/data-sources/[id]/components/ColumnRoleFields.tsx Improved label clarity for optional fields

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

Comment on lines 44 to 46
if (!areaStats || !map) {
prevAreaStatValues.current = new Map();
return;
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The removal of the cleanup function from this useEffect could lead to stale state issues. The previous implementation had a cleanup function that reset areaCodesToClean.current and prevAreaStatValues.current when the effect was torn down (component unmount or dependency change).

Now, line 45 only clears prevAreaStatValues.current when !areaStats || !map, but areaCodesToClean.current is never reset. This means:

  1. If the component unmounts and remounts, areaCodesToClean.current will still have old area codes from the previous mount
  2. When dependencies change but the ref persists, old area codes might not be cleaned up properly

Consider either:

  • Restoring the cleanup function to reset both refs
  • Also resetting areaCodesToClean.current on line 45 along with prevAreaStatValues.current

Copilot uses AI. Check for mistakes.
@joaquimds joaquimds force-pushed the fix/mapped-for-funders-fixes branch from a84b17e to 21c9bc9 Compare February 5, 2026 13:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@joaquimds joaquimds merged commit e9d6d19 into main Feb 5, 2026
@joaquimds joaquimds deleted the fix/mapped-for-funders-fixes branch February 5, 2026 13:14
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.

1 participant