Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (mounted.current) {
setDocument(resolved);
}
} catch (error) {
throw Error('error loading GraphQL document');
}
}
}, [documentOrAsyncDocument, mounted]);
useEffect(() => {
if (!document) {
loadDocument();
}
}, [document, loadDocument]);
useAsyncAsset(
isDocumentNode(documentOrAsyncDocument)
? undefined
: documentOrAsyncDocument.resolver.id,
);
return document;
}