pyapp-kit / ndv

Simple, fast-loading, n-dimensional array viewer with minimal dependencies.
BSD 3-Clause "New" or "Revised" License
35 stars 5 forks source link

bug: deal with issue when asynchronous data requests are no longer valid for the number of dimensions being displayed #17

Open tlambert03 opened 3 months ago

tlambert03 commented 3 months ago

in #15 I added the line

        if not data.ndim == self._ndim:
            warnings.warn(
                f"Got wrong number of dimensions ({data.ndim}) for vispy "
                f"visual of type {type(self._visual)}.",
                stacklevel=2,
            )
            return

to the vispy image handle... but I suspect it's indicative of something that needs to be handled higher up, in the stack viewer itself, essentially invalidating any requests for data that were sent out before a user clicked the change ndim button