diff --git a/CHANGELOG.md b/CHANGELOG.md index ab08d1ae6..fe4888737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Allow Editing of "Renewal Date" and "Subscription to" on open purchase order line. Refs UIOR-1078. * 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 (