Skip to content

Commit c8e3737

Browse files
committed
Fix applying onPassword and onLoadProgress to loadingTask
Fixes #364
1 parent 9dbc54e commit c8e3737

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Document.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ export default class Document extends PureComponent {
104104
const { options, onLoadProgress, onPassword } = this.props;
105105

106106
try {
107-
const loadingTask = pdfjs.getDocument({ ...source, ...options }).promise;
107+
const loadingTask = pdfjs.getDocument({ ...source, ...options });
108108
loadingTask.onPassword = onPassword;
109109
if (onLoadProgress) {
110110
loadingTask.onProgress = onLoadProgress;
111111
}
112-
const cancellable = makeCancellable(loadingTask);
112+
const cancellable = makeCancellable(loadingTask.promise);
113113
this.runningTask = cancellable;
114114
const pdf = await cancellable.promise;
115115
this.setState((prevState) => {

0 commit comments

Comments
 (0)