Repository navigation
[react-pdf] 첫 렌더 시 페이지가 컨테이너보다 넓게 그려지는 문제 수정 - #230
Merged
Merged
Conversation
Member
Author
|
/canary-publish |
Collaborator
✅ Changeset detectedLatest commit: 459df2f
If no version change is needed, please add The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
|
Collaborator
🔍 No files have been changedLatest commit: 459df2f Please check your commit. powered by: naverpay size-action |
2-one-week
enabled auto-merge
October 21, 2026 06:22
kyungmi
reviewed
Oct 21, 2026
| return null | ||
| /* 첫 렌더에서도 컨테이너 폭을 측정할 수 있도록 높이 0인 div에 ref를 연결한다. | ||
| * ref가 없으면 window.innerWidth로 계산되어 컨테이너보다 넓게 그려진다. */ | ||
| return <div ref={ref} style={style} /> |
There was a problem hiding this comment.
className={cx('article')} 까지 포함될 필요는 없을까요?
Member
Author
There was a problem hiding this comment.
네네 괜찮을 것 같습니다! 기존 동작이 null 이였어서 article 넣으면 min-height : 100% 때문에 로딩중에 회색 부분 보일 것 같습니다..!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Describe your changes
maxPageWidth={768}, 감싼 영역 768px, 창 폭 1439px인 환경에서 첫 로드 시 canvas가 768px로 그려져.document(754px)보다 넓게 렌더링되는 문제가 있었습니다. (창 크기 변경 후에는 754px로 정상)width가 계산되기 전에는PdfViewer가null을 반환해ref가 연결된 div가 마운트되지 않습니다. 그래서 첫 측정 시refElement.current가 없어window.innerWidth(1439)로 fallback되고,min(1439 - 14, 768) = 768이 됩니다.ref를 연결한 빈 div(style동일 적용)를 렌더링해, 첫 측정부터 컨테이너 폭(768 - 14 = 754) 기준으로 계산되도록 합니다.Request
patch로 지정했습니다.