@signiphi/page-assembly 0.2.0-beta.6 → 0.2.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2014,8 +2014,9 @@ var PageAssembler = React7.forwardRef(
2014
2014
  setProcessingStatus("");
2015
2015
  }
2016
2016
  }, []);
2017
+ const hasRestorableState = !!initialState && initialState.files.length > 0;
2017
2018
  React7.useEffect(() => {
2018
- if (initialPdf && !initialState) {
2019
+ if (initialPdf && state.files.length === 0 && !hasRestorableState) {
2019
2020
  const pdfIdentifier = initialPdf instanceof Uint8Array ? `uint8array-${initialPdf.length}-${initialPdf[0]}-${initialPdf[initialPdf.length - 1]}` : `${initialPdf.constructor.name}-${initialPdf.size || initialPdf.byteLength}`;
2020
2021
  if (processedInitialPdfRef.current === pdfIdentifier) {
2021
2022
  return;
@@ -2023,9 +2024,9 @@ var PageAssembler = React7.forwardRef(
2023
2024
  processedInitialPdfRef.current = pdfIdentifier;
2024
2025
  processInitialPdf(initialPdf);
2025
2026
  }
2026
- }, [initialPdf, initialState, processInitialPdf]);
2027
+ }, [initialPdf, state.files.length, hasRestorableState, processInitialPdf]);
2027
2028
  React7.useEffect(() => {
2028
- if (initialState) {
2029
+ if (initialState && initialState.files.length > 0) {
2029
2030
  dispatch({ type: "RESET", payload: initialState });
2030
2031
  }
2031
2032
  }, [initialState]);