PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
260 stars 169 forks source link

[Client] Fix issue with clearing multitag buffer #1299

Closed DevonRD closed 3 months ago

DevonRD commented 3 months ago

The state multitagResultBuffer dictionary uses integer keys, and stringifying the reference key yielded null results. This caused an infinite while loop on "Reset Samples" (null is always != 0) and caused the entire multitag pose standard deviation section to display the nullish-coalesced default values. Fixed the reference and added in a nullish coalescing condition on the suspect while loop to avoid the frontend lockup if this is somehow encountered again in the future

Fixes #1203

srimanachanta commented 3 months ago

Is there a more efficient way we could go about clearing the sample buffer instead of using a loop to clear it? Can't we set the length of the array to 0?

DevonRD commented 3 months ago

Is there a more efficient way we could go about clearing the sample buffer instead of using a loop to clear it? Can't we set the length of the array to 0?

Updated

DevonRD commented 3 months ago

Also found and fixed a bug where if the buffer was undefined when going into the tab (e.g. viewing "Targets" before having multiple targets) the multitarget buffer was not reactive. It needs to be pre-initialized to an empty array if attempting to reference it in this scenario