openms-insight 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,11 @@ _COMPONENT_DATA_CACHE_KEY = "_svc_component_data_cache"
56
56
  # Stores annotation dataframes returned by components like SequenceView
57
57
  _COMPONENT_ANNOTATIONS_KEY = "_svc_component_annotations"
58
58
 
59
+ # Session state key for batch resend flag
60
+ # When any component requests data (e.g., after page navigation), we clear
61
+ # ALL hashes on the next render so all components get data in one rerun
62
+ _BATCH_RESEND_KEY = "_svc_batch_resend"
63
+
59
64
 
60
65
  def _get_component_cache() -> Dict[str, Any]:
61
66
  """Get per-component data cache from session state."""
@@ -319,6 +324,12 @@ def render_component(
319
324
  # Get current state
320
325
  state = state_manager.get_state_for_vue()
321
326
 
327
+ # Batch resend: if any component requested data in previous run, clear ALL hashes
328
+ # This ensures all components get data in one rerun instead of O(N) reruns
329
+ if st.session_state.get(_BATCH_RESEND_KEY):
330
+ st.session_state[_VUE_ECHOED_HASH_KEY] = {}
331
+ st.session_state.pop(_BATCH_RESEND_KEY, None)
332
+
322
333
  # Generate unique key if not provided (needed for cache)
323
334
  # Use cache_id instead of id(component) since components are recreated each rerun
324
335
  # Use JSON serialization for deterministic key generation (hash() can vary)
@@ -379,12 +390,12 @@ def render_component(
379
390
  if _VUE_ECHOED_HASH_KEY not in st.session_state:
380
391
  st.session_state[_VUE_ECHOED_HASH_KEY] = {}
381
392
 
382
- # Hash tracking key includes filter state so different filter values have separate tracking
383
- # This ensures data is re-sent when filters change (e.g., different spectrum selected)
384
- hash_tracking_key = f"{key}:{filter_state_hashable}"
393
+ # Hash tracking key is the component's Streamlit key
394
+ # Filter state changes are handled by data_hash comparison (different data = different hash)
395
+ hash_tracking_key = key
385
396
 
386
- # Get Vue's last-echoed hash for this component + filter state
387
- # This is what Vue reported having in its last response for this exact filter state
397
+ # Get Vue's last-echoed hash for this component
398
+ # This is what Vue reported having in its last response
388
399
  vue_echoed_hash = st.session_state[_VUE_ECHOED_HASH_KEY].get(hash_tracking_key)
389
400
 
390
401
  # Send data if Vue's hash doesn't match current hash
@@ -475,9 +486,12 @@ def render_component(
475
486
  # Check if Vue is requesting data due to cache miss (e.g., after page navigation)
476
487
  # Vue's cache was empty when it received dataChanged=false, so it needs data resent
477
488
  request_data = result.get("_requestData", False)
478
- if request_data:
479
- # Clear our stored hash to force data resend on next render
480
- st.session_state[_VUE_ECHOED_HASH_KEY].pop(hash_tracking_key, None)
489
+ if request_data and not data_changed:
490
+ # Vue needs data and we didn't just send it - batch for next run
491
+ # This triggers ONE rerun that clears ALL hashes, so all components
492
+ # get data together instead of O(N) separate reruns
493
+ st.session_state[_BATCH_RESEND_KEY] = True
494
+ # Note: if data_changed=True, we just sent data so requestData is stale
481
495
 
482
496
  # Capture annotations from Vue (e.g., from SequenceView)
483
497
  # Use hash-based change detection for robustness
@@ -505,10 +519,11 @@ def render_component(
505
519
  annotations_changed = True
506
520
  st.session_state[ann_hash_key] = None
507
521
 
508
- # Update state and rerun if state changed OR annotations changed OR data requested
509
- # Hash comparison will naturally detect changes on the next render
522
+ # Update state and rerun if state changed OR annotations changed OR batch resend needed
523
+ # Only rerun for requestData if we didn't already send data (to avoid stale triggers)
510
524
  state_changed = state_manager.update_from_vue(result)
511
- if state_changed or annotations_changed or request_data:
525
+ needs_batch_resend = request_data and not data_changed
526
+ if state_changed or annotations_changed or needs_batch_resend:
512
527
  st.rerun()
513
528
 
514
529
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openms-insight
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Interactive visualization components for mass spectrometry data in Streamlit
5
5
  Project-URL: Homepage, https://github.com/t0mdavid-m/OpenMS-Insight
6
6
  Project-URL: Documentation, https://github.com/t0mdavid-m/OpenMS-Insight#readme
@@ -1,4 +1,4 @@
1
- openms_insight/__init__.py,sha256=fqk7DwB4PY-BOi2-uT9FCARBYen_3SPmnSnScVKBnQY,1111
1
+ openms_insight/__init__.py,sha256=b4H9k0fPVZ6jCiJ4QVSwzlUQnyElF6ZwAlDI8fdPMJE,1111
2
2
  openms_insight/components/__init__.py,sha256=Lcg-D0FILta-YVgMJBlWMKLKC5G5kXOqdy9hBOENABw,233
3
3
  openms_insight/components/heatmap.py,sha256=psrdW4gNzZR1jAIox9YS9EHaZaTRrDHFR0t2_0APU9Y,47214
4
4
  openms_insight/components/lineplot.py,sha256=I-JPvDzCr3Nu8Boc1V4D8QQ1bHgTqvM6CbeoIe7zJ-s,30896
@@ -16,15 +16,15 @@ openms_insight/preprocessing/compression.py,sha256=T4YbX9PUlfTfPit_kpuLZn8hYpqLY
16
16
  openms_insight/preprocessing/filtering.py,sha256=fkmaIXfR5hfjyWfaMYqaeybMHaZjvUZYaKCqvxPOWMQ,14152
17
17
  openms_insight/preprocessing/scatter.py,sha256=2ifCNTUKHEW9UVpv4z9c5GaLnz5zw9o1119IenzAe9s,4703
18
18
  openms_insight/rendering/__init__.py,sha256=ApHvKeh87yY4GTIEai-tCeIXpNbwOXWlmcmIwMMRZYc,198
19
- openms_insight/rendering/bridge.py,sha256=Z8njsnVI-TCE6Beep7b2him-Hy8o2eYVDD-RxiHWDXo,20727
19
+ openms_insight/rendering/bridge.py,sha256=CxOcGWXZkR968_6x5-AkfxNYqKBIuuLya6RZVhZyMr0,21494
20
20
  openms_insight/js-component/dist/index.html,sha256=LSJ3B_YmGUrCCdZ1UaZO2p6Wqsih6nTH62Z_0uZxpD8,430
21
21
  openms_insight/js-component/dist/assets/index.css,sha256=wFvo7FbG132LL7uw0slXfrL_oSQ8u2RKL1DW9hD9-kk,884264
22
- openms_insight/js-component/dist/assets/index.js,sha256=lgH9C14vHdrRN48hjcHhjCRqOIJlHq3zduFveW7jSnE,6075088
22
+ openms_insight/js-component/dist/assets/index.js,sha256=rCYOyEKHcbMbz2V4RflVTQ8UW8fGuvZN6kFVxb-10tI,6075229
23
23
  openms_insight/js-component/dist/assets/materialdesignicons-webfont.eot,sha256=CxgxBNL8XyYZbnc8d72vLgVQn9QlnS0V7O3Kebh-hPk,1307880
24
24
  openms_insight/js-component/dist/assets/materialdesignicons-webfont.ttf,sha256=YeirpaTpgf4iz3yOi82-oAR251xiw38Bv37jM2HWhCg,1307660
25
25
  openms_insight/js-component/dist/assets/materialdesignicons-webfont.woff,sha256=pZKKDVwvYk5G-Y2bFcL2AEU3f3xZTdeKF1kTLqO0Y-s,587984
26
26
  openms_insight/js-component/dist/assets/materialdesignicons-webfont.woff2,sha256=Zi_vqPL4qVwYWI0hd0eJwQfGTnccvmWmmvRikcQxGvw,403216
27
- openms_insight-0.1.6.dist-info/METADATA,sha256=S--OtU9cCzBuY9UaIaDNuMivpOMPQaXwSZEAXqFpQu8,16670
28
- openms_insight-0.1.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
29
- openms_insight-0.1.6.dist-info/licenses/LICENSE,sha256=INFF4rOMmpah7Oi14hLqu7NTOsx56KRRNChAAUcfh2E,1823
30
- openms_insight-0.1.6.dist-info/RECORD,,
27
+ openms_insight-0.1.7.dist-info/METADATA,sha256=NvzVktj8Tyah67T7yAzUwEGuZFqXkiGV5GlTlY8aZyI,16670
28
+ openms_insight-0.1.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
29
+ openms_insight-0.1.7.dist-info/licenses/LICENSE,sha256=INFF4rOMmpah7Oi14hLqu7NTOsx56KRRNChAAUcfh2E,1823
30
+ openms_insight-0.1.7.dist-info/RECORD,,