From 36638078f97959c380c46765a6407bffe931892d Mon Sep 17 00:00:00 2001 From: Mikita Siadykh Date: Thu, 2 Nov 2023 22:34:05 +0400 Subject: [PATCH] UIOR-1173 Preview contains blank page when trying to print an order (#1516) --- CHANGELOG.md | 1 + src/PrintOrder/PrintOrder.js | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1756c032..d721776aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## (5.0.1 IN PROGRESS) * Add missed permission to fetch org types in view only mode. Refs UIOR-1168. +* Preview contains blank page when trying to print an order. Refs UIOR-1173. ## [5.0.0](https://github.com/folio-org/ui-orders/tree/v5.0.0) (2023-10-12) [Full Changelog](https://github.com/folio-org/ui-orders/compare/v4.0.3...v5.0.0) diff --git a/src/PrintOrder/PrintOrder.js b/src/PrintOrder/PrintOrder.js index 42e61cecf..bd5436df5 100644 --- a/src/PrintOrder/PrintOrder.js +++ b/src/PrintOrder/PrintOrder.js @@ -41,12 +41,17 @@ export const PrintOrderComponent = ({ mutator, order, orderLine, onCancel }) => ...printData, }, })); - - handlePrint(); })(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + if (printableOrder) { + handlePrint(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [printableOrder]); + return (