Skip to content

Thumbnail display issue for a new background #11883

Description

@ElenaGallo

Description

The thumbnail cannot be displayed in the background selector for a background added to a map

thmbnail.mp4

How to reproduce

  • Open a map
  • Open the background selector
  • Add new background
  • Add the background thumbnail
  • Click on add the background

Expected Result

The thumbnail of the new background is visible in the background selector when it is closed

Current Result

The thumbnail of the new background is not visible in the background selector when it is closed

  • Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

Activity

  1. added this to the 2025.02.02 milestone on Jan 15, 2026
  2. subashtiwari1010 commented on Jan 16, 2026

    @subashtiwari1010
    Contributor

    Investigation Report:

    Root Cause:
    In this file web/client/components/background/BackgroundSelector.jsx:

    • getCurrentBackground() uses backgroundsProp.find(bg => bg.visibility === true), which returns the first visible background.
    • It does not exclude terrain layers, so as the terrain layer appears before the new background and both are visible, the terrain layer is filtered and selected.
    • Terrain layers don't have thumbnail images.

    Problem Scenario:

    • The backgroundsProp has the list of backgrounds available. It also contains the terrain layer in it.
    • When a new background is added, it's appended to the end of backgroundsProp list.
    • As both the terrain layer and the new background have visibility === true, find() selects the terrain layer (first match).
    • The selector then tries to display a thumbnail for the terrain layer, which doesn't exist, resulting in no thumbnail or a broken image.

    Solution:

    • Exclude terrain layers in getCurrentBackground() by filtering out type === 'terrain' before selecting the visible background.
    • Change the find function to:
      const visibleBackground = backgroundsProp.find(bg => bg.type !== 'terrain' && bg.visibility === true);
    • This ensures only non-terrain backgrounds are considered for thumbnail display.
  3. added a commit that references this issue on Jan 26, 2026
    07deeb4
  4. self-assigned this
    on Feb 3, 2026
  5. added a commit that references this issue on Feb 3, 2026
    05c2a0d
  6. added a commit that references this issue on Mar 13, 2026
    7239a92
  7. added a commit that references this issue on Jun 19, 2026
    acb4f07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions