Skip to content

fix(show): render all coordinate systems for type-distributed elements#718

Merged
timtreis merged 1 commit into
mainfrom
refactor/issue-694-leaked-cs
Jun 14, 2026
Merged

fix(show): render all coordinate systems for type-distributed elements#718
timtreis merged 1 commit into
mainfrom
refactor/issue-694-leaked-cs

Conversation

@timtreis

@timtreis timtreis commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #694.

_resolve_coordinate_systems computed elements_to_be_rendered from the leaked validation-loop variable cs — bound to the last coordinate system only. Because _get_elements_to_be_rendered keys on element type (has_images/has_labels/…), a CS lacking a queued element type was wrongly pruned by _get_valid_cs whenever elements of that type lived in another CS. For multi-CS plots with type-distributed elements, a coordinate system that should have rendered was silently dropped.

Fix

Union the elements across all coordinate systems before pruning (the comprehension scope also eliminates the leaked variable):

elements_to_be_rendered = list(
    dict.fromkeys(e for cs in coordinate_systems for e in _get_elements_to_be_rendered(render_cmds, cs_index, cs))
)

dict.fromkeys dedupes while preserving order.

#694)

_resolve_coordinate_systems computed elements_to_be_rendered from the
leaked loop variable cs (the last validated CS only). Since
_get_elements_to_be_rendered keys on element type, a CS lacking a queued
element type was wrongly pruned by _get_valid_cs when elements of that
type lived in another CS. Union the elements across all coordinate
systems instead.

Regression test: an image in one CS and labels in another now render two
panels (failed before: only the last CS survived).
@timtreis timtreis changed the title fix(show): render all coordinate systems for type-distributed elements (#694) fix(show): render all coordinate systems for type-distributed elements Jun 14, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.15%. Comparing base (4ba13a3) to head (9f8cdd2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #718      +/-   ##
==========================================
+ Coverage   77.13%   77.15%   +0.02%     
==========================================
  Files          14       14              
  Lines        4457     4457              
  Branches     1023     1023              
==========================================
+ Hits         3438     3439       +1     
  Misses        661      661              
+ Partials      358      357       -1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/basic.py 82.60% <100.00%> (+0.24%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 7a1b3a3 into main Jun 14, 2026
7 of 8 checks passed
@timtreis timtreis deleted the refactor/issue-694-leaked-cs branch June 14, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show(): elements_to_be_rendered computed from leaked loop variable (multi-CS bug)

2 participants