|
@@ -100,15 +100,17 @@ export function SpoolBuddyLayout() {
|
|
|
};
|
|
};
|
|
|
}, [resetActivity]);
|
|
}, [resetActivity]);
|
|
|
|
|
|
|
|
- // Auto-navigate to dashboard when a tag is detected on a non-dashboard page
|
|
|
|
|
|
|
+ // Auto-navigate to dashboard when a NEW tag is detected (transition from no-tag to tag)
|
|
|
const tagDetected = Boolean(sbState.matchedSpool || sbState.unknownTagUid);
|
|
const tagDetected = Boolean(sbState.matchedSpool || sbState.unknownTagUid);
|
|
|
|
|
+ const prevTagDetected = useRef(false);
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (tagDetected) {
|
|
|
|
|
|
|
+ if (tagDetected && !prevTagDetected.current) {
|
|
|
resetActivity();
|
|
resetActivity();
|
|
|
if (location.pathname !== '/spoolbuddy') {
|
|
if (location.pathname !== '/spoolbuddy') {
|
|
|
navigate('/spoolbuddy');
|
|
navigate('/spoolbuddy');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ prevTagDetected.current = tagDetected;
|
|
|
}, [tagDetected, location.pathname, navigate, resetActivity]);
|
|
}, [tagDetected, location.pathname, navigate, resetActivity]);
|
|
|
|
|
|
|
|
// Screen blank timer
|
|
// Screen blank timer
|