How do i trigger a startDiscovery on button click? #237
zxleeaxrail
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Everytime i trigger a button click to start discovering printers, it stops discovering with the error:
Tried to start search when search had been already done.
const safeStart = useCallback(() => { console.log("Printer discovery error safestart", printerError); if (!isDiscovering) { try { start({ timeout: 10000, // keep scan alive ~10s filterOption: { portType: DiscoveryPortType.PORTTYPE_ALL }, // or BLUETOOTH / ETHERNET }); } catch (error) { console.error("Error starting printer discovery:", error); } } }, [isDiscovering, start]);
useEffect(() => { try { if (!isDiscovering) { start({ timeout: 10000, // keep scan alive ~10s filterOption: { portType: DiscoveryPortType.PORTTYPE_ALL }, // or BLUETOOTH / ETHERNET }); } console.log("Printer discovery error", printerError); } catch (error) { console.error("Error starting printer discovery:", error); } }, []);
Beta Was this translation helpful? Give feedback.
All reactions