feat: enhance poster download functionality by ensuring images load before PDF generation and adding QR readiness check
This commit is contained in:
@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
|
||||
import QRCode from "qrcode";
|
||||
import { getStateInfoClient } from "@/lib/getStateInfoClient";
|
||||
|
||||
export default function QrImg() {
|
||||
export default function QrImg({ onReady }) {
|
||||
const [host, setHost] = useState("");
|
||||
const [qrCodeData, setQrCodeData] = useState("");
|
||||
|
||||
@@ -14,9 +14,14 @@ export default function QrImg() {
|
||||
setHost(linkHost);
|
||||
|
||||
if (linkURL) {
|
||||
QRCode.toDataURL(linkURL).then(setQrCodeData);
|
||||
QRCode.toDataURL(linkURL).then((url) => {
|
||||
setQrCodeData(url);
|
||||
onReady?.();
|
||||
});
|
||||
} else {
|
||||
onReady?.();
|
||||
}
|
||||
}, []);
|
||||
}, [onReady]);
|
||||
|
||||
return (
|
||||
<div className="flex items-center flex-col justify-center mt-[100%]">
|
||||
|
||||
Reference in New Issue
Block a user