Skip to content

Range param step updates#1580

Open
JoshuaVulcan wants to merge 1 commit into
ERA-8348from
ERA-13007
Open

Range param step updates#1580
JoshuaVulcan wants to merge 1 commit into
ERA-8348from
ERA-13007

Conversation

@JoshuaVulcan
Copy link
Copy Markdown
Collaborator

@JoshuaVulcan JoshuaVulcan commented May 27, 2026

feat: new range param steps, as per API updates.
feat: updating/simplifing geojson overlay, unbinding map moveend events to match.

What does this PR do?

https://allenai.atlassian.net/browse/ERA-13007

Evidence

N/A

Relevant link(s)

Notes

N/A

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

🚀 PR Environment Deployed

App Sync Health Image
pr-web-era-13007 ✅ Synced ✅ Healthy 4d698a30c37845f1178a5c8654e73506f8e32ca8

Access: https://era-13007.dev.pamdas.org

View in ArgoCD

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 vector-tile range parameter handling to match API step buckets, and refactors map overlay/tiles integration to simplify source management and realtime overlay fetching behavior.

Changes:

  • Add getVtRangeParam + buildVtTileUrl utilities and update track/subject tile layers to use stepped range buckets.
  • Adjust realtime overlay fetching to paginate and remove bbox dependency; add segment eviction to prevent unbounded growth.
  • Improve Mapbox layer/source cleanup safety (safeRemoveMapLayer) and update related layer cleanup logic/tests.

Reviewed changes

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

Show a summary per file
File Description
src/withSocketConnection/useRealTimeImplementation/config.js Clarifies ordering requirement for overlay update vs subject store overwrite.
src/utils/tracks.js Adds stepped range bucket logic and centralizes VT tile URL builder.
src/utils/tracks.test.js Adds unit tests for getVtRangeParam bucket selection.
src/utils/map.js Makes safeRemoveMapLayer resilient by checking layer existence first.
src/TrackSegmentsLayer/index.js Uses getVtRangeParam/buildVtTileUrl, memoizes visible IDs, and cleans up map source on unmount/range change.
src/TrackSegmentsLayer/index.test.js Updates expected range behavior and adds parametrized range tests (but mock needs fixing).
src/SubjectTrackLegend/index.js Removes per-item description field from legend items.
src/SubjectTileLayer/index.test.js Adds getVtRangeParam mock (but mock needs fixing).
src/SubjectTileLayer/index.js Switches to its own vector tile source and cleans up that source on unmount/range change.
src/Map/index.js Refactors overlay fetch into callback and removes map dependency from overlay refresh.
src/ducks/realtime-overlay.js Changes overlay subject fetch to paginate and adds eviction of stale segments in reducer.

Comment on lines +23 to +29
jest.mock('../utils/tracks', () => ({
getVtRangeParam: (days) => {
const steps = [30, 45, 60, 90, 150, 210, 365, 500];
const step = steps.find((s) => days <= s);
return step !== undefined ? String(step) : 'all';
},
}));
Comment on lines +39 to +45
jest.mock('../utils/tracks', () => ({
getVtRangeParam: (days) => {
const steps = [30, 45, 60, 90, 150, 210, 365, 500];
const step = steps.find((s) => days <= s);
return step !== undefined ? String(step) : 'all';
},
}));
Comment on lines 42 to 43
// Ensure the shared vector tile source exists (TrackSegmentsLayer may
// have already created it with the same range param).
Comment on lines +109 to +114
const subjectsData = await recursivePaginatedQuery(
axios.get(SUBJECTS_API_URL, {
cancelToken: cancelToken.token,
params: { updated_since: updatedSince, use_lkl: true, include_inactive: false },
})
) ?? [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants