Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
…ate related imports
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d3d30c63e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import times from 'lodash/times.js'; | ||
| import React, {useCallback, useLayoutEffect, useRef, useState} from 'react'; | ||
| import type {CSSProperties, ReactNode, JSX} from 'react'; | ||
| import {times} from 'lodash'; |
There was a problem hiding this comment.
Restore the CommonJS-safe lodash import
In the published package we emit ESM (package.json has "type": "module"), so this becomes import { times } from 'lodash'. lodash@4 is the CommonJS build, which means SSR/test environments that execute our dist files directly instead of prebundling them can fail at module load time before PDFPreviewer renders. The previous lodash/times.js default import avoided that interop problem.
Useful? React with 👍 / 👎.
src/PDFPreviewer.tsx
Outdated
| PDFPreviewer.displayName = 'PDFPreviewer'; | ||
|
|
||
| export default memo(PDFPreviewer); | ||
| export default PDFPreviewer; |
There was a problem hiding this comment.
Re-wrap PDFPreviewer in React.memo
Dropping memo turns every parent rerender into a rerender of Document plus all visible PageRenderer items, even when file, rotation, and sizing props are unchanged. For the attachment-viewer use case this component is optimized for, unrelated state updates now force large PDFs to repaint repeatedly. React.memo would still allow the new rotation prop to update correctly, so removing it is a performance regression rather than a requirement for the feature.
Useful? React with 👍 / 👎.
Details
Adds a rotation prop to PDFPreviewer that rotates all pages visually at runtime without modifying the
original file.
Related Issues
Expensify/App#80043
Manual Tests
Linked PRs