switches to using leaflet directly in js#700
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Expat/Repat “non-local ICB map” from the R leaflet package to a custom JavaScript Leaflet implementation, reducing R-side spatial dependencies and shifting map rendering to the browser.
Changes:
- Added a CDN-based Leaflet
htmlDependency()and wired it into the app head. - Replaced the Shiny
leafletOutput()/renderLeaflet()map with a plain<div>plussession$sendCustomMessage()data plumbing. - Removed R-side ICB boundary loading and dropped
leaflet/sf/viridis(and related) imports fromDESCRIPTION.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| R/ZZZ.R | Adds use_leafletjs() dependency helper for Leaflet assets. |
| R/mod_home_server.R | Prevents temp file deletion when running in Shiny dev mode. |
| R/mod_expat_repat_utils.R | Removes the R leaflet map helper function. |
| R/mod_expat_repat_ui.R | Replaces leafletOutput() with a static div container for the JS map. |
| R/mod_expat_repat_server.R | Sends ICB percentages to the browser via custom message instead of renderLeaflet(). |
| R/fct_utils_lookups.R | Removes ICB boundaries from cached lookups. |
| R/app_ui.R | Injects Leaflet dependency into the app <head> resources. |
| inst/app/www/map.js | Implements Leaflet map rendering and Shiny custom-message handling in JavaScript. |
| DESCRIPTION | Removes now-unused spatial/mapping-related R imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
matt-dray
approved these changes
Jul 15, 2026
matt-dray
left a comment
Contributor
There was a problem hiding this comment.
Thank you, sensible change. Loads in as expected. Great to see the removal of several dependencies. Complements The-Strategy-Unit/nhp_inputs_selection_app#1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
currently we use leaflet to render a map, but the leaflet R package brings in sf as a dependency, and that brings in terra.
both sf and terra are failing to compile on our connect server, as the binaries are no longer available for ubuntu 22.04 of these packages.
this PR switches to rendering the map entirely in JS, removing the direct need for sf/terra in R