Skip to content

Samples table and phase-msg 'Samples in View' diverge during point-mode cache-hit pans #221

@rdhyee

Description

@rdhyee

Scoped out of #219. Documented in EXPLORER_STATE.md §6 table v2 viewport-coupling paragraph.

Bug

The two surfaces that report sample counts in the current viewport use different cache strategies:

  • Phase-msg "Samples in View" / #sSamples stat box: written by loadViewportSamples() in zoomWatcher. Reuses cachedTotalCount from the previous query whenever the new viewport is within the previously-fetched padded bounds (isWithinCache(bounds) short-circuit). Designed to make panning feel smooth.
  • Samples table (post PR Samples table: scope to current viewport bbox #219): re-queries on every viewer.camera.moveEnd. Always reflects the current 30%-padded viewport bbox.

Result: on cache-hit pans the table refetches and gets a slightly different total than what the phase-msg shows from its earlier fetch. E.g. table=147, phase-msg=153 from the prior fetch.

Primary #219 bug (table=6M while phase-msg=153 at the same viewport) is fully resolved; this is a smaller residual divergence.

Options

  1. Make the table reuse the point-mode cache. When loadViewportSamples() short-circuits on a cache hit, signal the table to also short-circuit (don't refetch; trust the previous totals). Couples tableView to a zoomWatcher internal.
  2. Make point-mode always refetch the count. Drop the cache-hit short-circuit for cachedTotalCount so each moveEnd refetches. Slight perf regression on rapid panning.
  3. Make both share a single bbox-snapshot + count cache. Cleanest architecturally; more refactor.

How to reproduce

Zoom into point mode somewhere with >5K samples (e.g. Cyprus / Polis). Pan a small amount (within ~30% of the original bbox). Compare table row total to phase-msg "samples in view" — they should differ slightly.

References

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