Hello there.
I’m migrating from 2025-07 to 2026-01 and I’m not only moving every single component from the react package to the polaris components (how fun and productive!) one of my favorite buggy behaviors are back.
If you use the
useEffect(() => {
const unsubscribeData = shopify.scanner.scannerData.current.subscribe((result) => {
setScanData(result.data || '');
setScanSource(result.source || '');
});
const unsubscribeSources = shopify.scanner.sources.current.subscribe((sources) => {
setHasCameraScanner(sources.includes('camera'));
setHasExternalScanner(sources.includes('external'));
});
return () => {
unsubscribeData();
unsubscribeSources();
};
}, []);
and get the scan data, you can do stuff with it. Nice.
And if you unmount this scanner component and mount another one, in the same extension/modal, if you go back to the scanner component with a new mount with the intention of scanning something new again, the current subscription already returns the old/stale scan data.
Even tho I’ve already called the unsub function, there’s stale data from a scan that is 5 minutes ago, still being returned in the current object.
Now I have to write a custom scanner state management on top of your scanner subscribeable because it’s not being cleared properly.