mikecousins/react-pdf-js

It doesn't rerender when binaryContent changes

Closed this issue · 1 comments

When rendering a PDF by binaryContent, such as:

<PDF binaryContent={this.props.file} />

It doesn't rerender when binaryContent changes because componentWillReceiveProps doesn't check for changes in this prop to call this.loadPDFDocument(newProps):

if (newSource && newSource !== oldSource &&
    ((newProps.file && newProps.file !== this.props.file) ||
    (newProps.content && newProps.content !== this.props.content) ||
    (newDocInit && JSON.stringify(newDocInit) !== JSON.stringify(docInit)))) {
    this.loadPDFDocument(newProps);
}

Thanks.