Skip to content

Fix #12739: keep the restored current time on map load, snap only when no time is set - #12740

Merged
dsuren1 merged 1 commit into
geosolutions-it:masterfrom
offtherailz:fix/timeline-currenttime-snap-on-load
Jul 29, 2026
Merged

Fix #12739: keep the restored current time on map load, snap only when no time is set#12740
dsuren1 merged 1 commit into
geosolutions-it:masterfrom
offtherailz:fix/timeline-currenttime-snap-on-load

Conversation

@offtherailz

Copy link
Copy Markdown
Member

Description

On map load the Timeline re-snaps the guide layer time and can overwrite a current time restored from the saved config. This change keeps the restored value and snaps only when there is no current time to preserve.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix

Issue

What is the current behavior?

#12739

When a map with a time layer is reloaded with a saved current time, the Timeline snaps that time to the nearest layer domain value on load. If the saved instant is not exactly a domain value, the current time (and the WMS TIME sent to the layer) changes to a different date. The result also depends on the timing of the asynchronous multidimensional describeDomains request, so it is not deterministic.

Root cause: on MAP_CONFIG_LOADED, epics/dimension.js updateLayerDimensionDataOnMapLoad restores the current time and then asynchronously loads the domains. Meanwhile epics/timeline.js selects the guide layer (updateTimelineDataOnMapLoad, or onUpdateLayerDimensionData when none is selected). Selecting the guide layer snaps the time: both initializeSelectLayer and selectLayer default to snap = true, so snapTimeGuideLayer runs setCurrentTime(nearestDomainValue) over the restored value.

What is the new behavior?

The saved value wins when it exists; snapping happens only when there is no restored current time. On load the guide layer is still selected, but without snapping when a current time was restored from the config. User-driven layer selection keeps snapping as before.

Proposed fix, in web/client/epics/timeline.js:

  • updateTimelineDataOnMapLoad: initializeSelectLayer(selectedLayer, isEmpty(currentTime)).
  • syncTimelineGuideLayer: selectLayer(firstTimeLayer, isEmpty(currentTimeSelector(state))).

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • No

Other useful information

Regression tests added in web/client/epics/__tests__/timeline-test.js:

  • syncTimelineGuideLayer selects with snap = true when no current time is set, and with snap = false when a current time is already set.
  • updateTimelineDataOnMapLoad selects with snap = false when a current time is restored, and with snap = true (plus AUTOSELECT) when none is.

How to reproduce: load a saved map with a WMS time layer (WMTS multidimensional extension) whose stored dimensionData.currentTime is not one of the layer domain values and whose timelineData.selectedLayer points to that layer. Before the fix the time snaps to a different value on load; after the fix the saved time is kept.

@cla-bot cla-bot Bot added the CLA Ready label Jul 27, 2026
@offtherailz offtherailz linked an issue Jul 27, 2026 that may be closed by this pull request
1 task
@offtherailz offtherailz added this to the 2026.02.01 milestone Jul 27, 2026
@offtherailz
offtherailz requested review from allyoucanmap and removed request for allyoucanmap July 27, 2026 14:28
@offtherailz
offtherailz requested a review from dsuren1 July 27, 2026 14:31
@dsuren1
dsuren1 merged commit 6e2ab56 into geosolutions-it:master Jul 29, 2026
17 checks passed
@offtherailz

Copy link
Copy Markdown
Member Author

@dsuren1

dsuren1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@ElenaGallo Kindly test it in DEV. Thanks!

offtherailz added a commit that referenced this pull request Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeline saved date changes on reload

3 participants