mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-24 00:36:39 +00:00
Fixes https://github.com/inventree/InvenTree/issues/13164
(cherry picked from commit 2310b54e26)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
1 parent
7f3171451c
commit
5618ba7907
1 file changed
+10
-2
@@ -112,8 +112,16 @@ export default function BarcodeCameraInput({
|
||||
legacyScannerRef.current = new Html5Qrcode('reader');
|
||||
}
|
||||
|
||||
Html5Qrcode.getCameras().then((devices) => {
|
||||
if (devices?.length) {
|
||||
Html5Qrcode.getCameras().then((cameraList) => {
|
||||
// Some browsers (e.g. Firefox on Linux) can report the same physical
|
||||
// camera more than once with an identical deviceId. Mantine's Select
|
||||
// throws on duplicate option values, so de-duplicate by id here.
|
||||
const devices = (cameraList ?? []).filter(
|
||||
(device, index, list) =>
|
||||
list.findIndex((other) => other.id === device.id) === index
|
||||
);
|
||||
|
||||
if (devices.length) {
|
||||
setCameras(devices);
|
||||
|
||||
// Auto-select a camera so the play button is immediately usable,
|
||||
|
||||
Reference in new issue
Block a user