Skip to content

Stories tool causes unnecessary map "reload" on close when story doesn't change layers #425

Description

@anneb

Description

When closing a Story in the Stories tool, the map visually reloads (globe zoom, layers re-streaming) even when the story never adds, removes, or hides any layers itself.

Cause

In StoryView.svelte, hideAllLayers() is called unconditionally in onMount, and removeAllLayers() / restoreStartLayerState() are called unconditionally in resetToStart() (on destroy). This hides all currently visible map layers when opening any story, and re-shows them when closing it — even for stories where every step has an empty layers array and never touches the map.

Re-showing previously hidden layers can trigger Cesium to re-stream/reload tiles, which looks like a full map reset to the user, even though nothing about the map actually needed to change.

Steps to reproduce

  1. Configure a story where all steps have "layers": [] (info/HTML-only story).
  2. Open the story, then close it.
  3. Observe the map reloads/reruns tile loading, even though no layer state should have changed.

Proposed fix

Compute whether the story defines any layers at all (hasStoryLayers), and only call the layer hide/restore logic when that's true. Terrain provider and globe opacity resets are left unconditional since they are safe no-ops when unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions