From 41cd58e72e8b06cbd6d5bb6d653d7b9c5707aef7 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sat, 1 Aug 2026 16:02:33 +0200 Subject: [PATCH] refactor(printing): only use the correct context Instead of always trying to get both contexts, we only get those that we actually need. Signed-off-by: Philip Molares --- .../editor-page/hooks/use-print-keyboard-shortcut.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/editor-page/hooks/use-print-keyboard-shortcut.ts b/frontend/src/components/editor-page/hooks/use-print-keyboard-shortcut.ts index eccff72e8..8628e2548 100644 --- a/frontend/src/components/editor-page/hooks/use-print-keyboard-shortcut.ts +++ b/frontend/src/components/editor-page/hooks/use-print-keyboard-shortcut.ts @@ -10,8 +10,6 @@ import { useCallback, useEffect, useMemo } from 'react' * Hook to listen for the print keyboard shortcut and print the content of the renderer iframe. */ export const usePrintKeyboardShortcut = (): void => { - const printCallbackOutside = usePrintIframe() - const printCallbackInside = usePrintSelf() const isIframe = useMemo(() => window.top !== window.self, []) const handlePrint = useCallback( @@ -19,13 +17,13 @@ export const usePrintKeyboardShortcut = (): void => { if (event.key === 'p' && (event.ctrlKey || event.metaKey)) { event.preventDefault() if (isIframe) { - printCallbackInside() + usePrintSelf()() } else { - printCallbackOutside() + usePrintIframe()() } } }, - [isIframe, printCallbackInside, printCallbackOutside] + [isIframe] ) useEffect(() => {