If loadSomeData is asynchronous, like it is when the data has to come from a network source, it yields control and allows setImageInfo to run before setData. BUT if it is synchronous, as is the case when data comes straight from cache, then setData is called immediately, before setImageInfo gets a chance to run.
The solution is just to move setImageInfo up to before loadSomeData. So that's what this fix does. No code behavior is actually modified besides being shuffled around.
Fixes a bug where
Volume
s loaded fromOmeZarrLoader
would appear blank when the data was fetched from cache.This problem was caused because the volume's
imageInfo
was not being updated until after the data had been loaded. Consider the following pseudocode:If
loadSomeData
is asynchronous, like it is when the data has to come from a network source, it yields control and allowssetImageInfo
to run beforesetData
. BUT if it is synchronous, as is the case when data comes straight from cache, thensetData
is called immediately, beforesetImageInfo
gets a chance to run.The solution is just to move
setImageInfo
up to beforeloadSomeData
. So that's what this fix does. No code behavior is actually modified besides being shuffled around.