Tags: hustcc/size-sensor
Tags
fix: Add null check in destroy() before disconnecting sensor (#21) * fix: Add null check in destroy() before disconnecting sensor Fixes a TypeError that occurs when sensor.disconnect() is called on an already destroyed sensor during React StrictMode's double mount/unmount cycle. The destroy() function attempted to call sensor.disconnect() without checking if sensor was still defined, leading to: "TypeError: Cannot read properties of undefined (reading 'disconnect')" This commonly occurs in React 18+ StrictMode environments where components are intentionally mounted and unmounted twice to detect side effects, causing multiple destroy() calls on the same sensor. * Bump version from 1.0.2 to 1.0.3 --------- Co-authored-by: hustcc <i@hust.cc>