Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit fab0d94

Browse files
committed
Fixed issue where the user attribute is not set due to it being async
1 parent 236d280 commit fab0d94

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/PDFViewer.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const PDFViewer: React.FC<InputProps> = props => {
4141
};
4242
}, [wvInstance]);
4343

44+
// Mount WV only once
4445
useEffect(() => {
4546
viewer(
4647
{
@@ -123,12 +124,20 @@ const PDFViewer: React.FC<InputProps> = props => {
123124
});
124125
}, [viewer]);
125126

127+
// Attributes in Mendix may update later, this will load the file after the update
126128
useEffect(() => {
127129
if (wvInstance && props.file) {
128130
wvInstance.UI.loadDocument(props.file);
129131
}
130132
}, [wvInstance, props.file]);
131133

134+
// Attributes in Mendix may update later, this will load the file after the update
135+
useEffect(() => {
136+
if (wvInstance && props.annotationUser) {
137+
wvInstance.Core.annotationManager.setCurrentUser(props.annotationUser);
138+
}
139+
}, [wvInstance, props.annotationUser]);
140+
132141
return (
133142
<div
134143
className="webviewer"

0 commit comments

Comments
 (0)