Skip to content

fix: Lazy load country polygons to prevent UI freeze (#1056)#1188

Merged
karilint merged 4 commits into
mainfrom
codex/1056-web-freezing-locality-map
May 29, 2026
Merged

fix: Lazy load country polygons to prevent UI freeze (#1056)#1188
karilint merged 4 commits into
mainfrom
codex/1056-web-freezing-locality-map

Conversation

@karilint
Copy link
Copy Markdown
Collaborator

Fix #1056: Web freezing when loading locality map.

Root Cause:
The countryPolygons.ts module is 4.4MB and was being imported synchronously, blocking the main thread and causing UI freezes.

Solution:

  • Dynamically import countryPolygons using async import()
  • Only load the polygon data after the map component mounts
  • Add loading state for country borders

Impact:

  • Eliminates UI freeze when loading the map
  • Improves initial page load performance
  • Country borders now load asynchronously after map is ready

Testing:

  • Manual test: Open LocalitiesMap, verify it loads without freezing
  • Check console for any errors during map loading

Fix #1056: Web freezing when loading locality map.

The countryPolygons.ts file is 4.4MB and was being imported synchronously,
causing the main thread to block and the UI to freeze.

Solution:
- Dynamically import countryPolygons using async import()
- Only load the data after the map component mounts
- Add loading state for country borders

This prevents the large module from blocking the main thread during
initial page load.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@karilint
Copy link
Copy Markdown
Collaborator Author

@copilot Please review this pull request.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

@copilot Please review this pull request.

Reviewed and addressed issues in the map lazy-loading changes.

Updated in commits:

@karilint
Copy link
Copy Markdown
Collaborator Author

@copilot Please review this pull request.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

@copilot Please review this pull request.

Reviewed the current PR changes. I don’t see additional code changes needed at this point. I also re-ran validation locally (npm run lint, npm run tsc, and frontend tests), and they pass.

@karilint karilint marked this pull request as ready for review May 29, 2026 13:20
@karilint karilint merged commit f819ce6 into main May 29, 2026
5 checks passed
@karilint karilint deleted the codex/1056-web-freezing-locality-map branch May 29, 2026 13:20
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.

web freezing when loading locality map

2 participants