Skip to content

switches to using leaflet directly in js#700

Merged
tomjemmett merged 2 commits into
mainfrom
leaflet_js
Jul 15, 2026
Merged

switches to using leaflet directly in js#700
tomjemmett merged 2 commits into
mainfrom
leaflet_js

Conversation

@tomjemmett

@tomjemmett tomjemmett commented Jul 14, 2026

Copy link
Copy Markdown
Member

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

Copilot AI review requested due to automatic review settings July 14, 2026 15:08
@tomjemmett
tomjemmett requested a review from a team as a code owner July 14, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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> plus session$sendCustomMessage() data plumbing.
  • Removed R-side ICB boundary loading and dropped leaflet/sf/viridis (and related) imports from DESCRIPTION.

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.

Comment thread inst/app/www/map.js
Comment thread R/ZZZ.R
Comment thread R/mod_expat_repat_server.R
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@matt-dray matt-dray added enhancement New feature or request should MoSCoW priority labels Jul 15, 2026
@matt-dray matt-dray added this to the v5.2.1 milestone Jul 15, 2026

@matt-dray matt-dray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@tomjemmett
tomjemmett merged commit a840158 into main Jul 15, 2026
3 checks passed
@tomjemmett
tomjemmett deleted the leaflet_js branch July 15, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request should MoSCoW priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants