Refactor: Add missing countdownTimerRef cleanup and top-level mounted guards
This commit is contained in:
@@ -216,6 +216,7 @@ export default function PreviewScreen({
|
||||
|
||||
// Triggers the view capture and the print job
|
||||
const handlePrint = async () => {
|
||||
if (!mountedRef.current) return;
|
||||
if (isProcessing) return;
|
||||
setIsProcessing(true);
|
||||
setStatusMessage('Dein Foto wird vorbereitet...');
|
||||
@@ -250,6 +251,7 @@ export default function PreviewScreen({
|
||||
|
||||
// Saves to gallery without printing
|
||||
const handleSaveOnly = async () => {
|
||||
if (!mountedRef.current) return;
|
||||
if (isProcessing) return;
|
||||
setIsProcessing(true);
|
||||
setStatusMessage('Bild wird generiert...');
|
||||
@@ -277,6 +279,7 @@ export default function PreviewScreen({
|
||||
|
||||
// Auto-save and exit
|
||||
const handleExit = useCallback(async () => {
|
||||
if (!mountedRef.current) return;
|
||||
if (isProcessing) return;
|
||||
const state = stateRef.current;
|
||||
if (state.stickers.length === 0 && state.layout === 'single' && !state.activeFrame && state.dateOverlay === 'off') {
|
||||
@@ -321,6 +324,7 @@ export default function PreviewScreen({
|
||||
}, [resetIdleTimer]);
|
||||
|
||||
const handleRetakeClick = async () => {
|
||||
if (!mountedRef.current) return;
|
||||
if (isProcessing) return;
|
||||
if (stickers.length > 0 || layout !== 'single' || activeFrame || dateOverlay !== 'off') {
|
||||
setIsProcessing(true);
|
||||
|
||||
Reference in New Issue
Block a user