Range param step updates#1580
Open
JoshuaVulcan wants to merge 1 commit into
Open
Conversation
🚀 PR Environment Deployed
Access: https://era-13007.dev.pamdas.org |
Contributor
There was a problem hiding this comment.
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+buildVtTileUrlutilities and update track/subject tile layers to use steppedrangebuckets. - 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 }, | ||
| }) | ||
| ) ?? []; |
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.
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