fix(#1181): RawSvg(OLE/차트) 첫 로드 백지 렌더 — 비동기 디코드 안전망 누락#1182
Merged
edwardkim merged 1 commit intoMay 31, 2026
Conversation
## 증상 samples/한셀OLE.hwp 등 OLE 미리보기 페이지를 rhwp-studio 에서 첫 로드 시 백지로 렌더되고, 두 번째 로드부터는 정상. 모듈 static IMAGE_CACHE 가 첫 로드 중 디코드한 HtmlImageElement 를 유지해 두 번째 호출에서만 img.complete() 분기로 즉시 그려지는 패턴. ## 원인 OLE/차트 미리보기는 PaintOp::RawSvg 로 emit (src/paint/json.rs:814) 되며 web_canvas RawSvg 핸들러는 단일 <image data:...> 또는 SVG 조각을 draw_image() 로 그려서 IMAGE_CACHE 비동기 디코드 경로를 그대로 탄다. 그런데 edwardkim#1154 v2 (PR edwardkim#1164) 의 디코드 안전망은 PaintOp::Image 만 image_count 에 포함시켜 RawSvg 케이스에서는: - rendering.rs collect() : image_count == 0 - page-renderer.ts scheduleReRender : if (imageCount <= 0) return 으로 200/600/1500ms 재시도 미발화 - prefetchFlowImages 정규식 ("type":"image") 도 rawSvg 미매칭 결과적으로 첫 렌더 후 캔버스가 백지로 남는다. ## 수정 1. src/document_core/queries/rendering.rs : collect() 가 PaintOp::RawSvg 도 image_count += 1 처리. scheduleReRender 재시도 발화 트리거. 2. rhwp-studio/src/view/page-renderer.ts : prefetchFlowImages 가 전체 JSON 의 data:image/MIME;base64,... 패턴을 직접 스캔하여 rawSvg 내장 데이터 URL 도 prefetch (중복 dedupe). 기존 image 항목 regex 는 유지. ## 검증 Puppeteer 측정 (samples/한셀OLE.hwp): | 시점 | 수정 전 load #1 | 수정 후 load #1 | 수정 후 load edwardkim#2 | |------|-----------------|-----------------|-----------------| | t+0ms | 6 (백지) | 1276 | 1276 | | t+1500ms | 6 (백지) | 1276 | 1276 | | t+3000ms | 6 (백지) | 1276 | 1276 | cargo test --lib document_core::queries::rendering : 6 passed. Closes edwardkim#1181
Owner
|
머지했습니다 (devel 검증(로컬):
참고: PR head 가 devel 보다 뒤처져 있어 GitHub UI 머지 대신 메인테이너 로컬 |
edwardkim
added a commit
that referenced
this pull request
May 31, 2026
…planet6897) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
PaintOp::RawSvg로 emit 되는 미리보기 페이지가 rhwp-studio 첫 로드 시 백지로 그려지던 회귀를 수정.PaintOp::Image만 대상으로 잡고 있어 RawSvg 경로 누락.Closes #1181
원인
OLE/차트 미리보기는
PaintOp::RawSvg로 emit (src/paint/json.rs:814) 되며 web_canvas RawSvg 핸들러는<image data:...>/ SVG 조각을draw_image()로 그려서 IMAGE_CACHE 비동기 디코드 경로를 그대로 탑니다. 그런데 #1154 v2 의 안전망은:rendering.rs collect():PaintOp::Image만 image_count++ → RawSvg 페이지는image_count == 0page-renderer.ts scheduleReRender:if (imageCount <= 0) return으로 200/600/1500ms 재시도 자체 미발화prefetchFlowImages정규식"type":"image"→ rawSvg 미매칭첫 렌더 후 캔버스가 백지로 남고, 두 번째 로드 때만 모듈 static
IMAGE_CACHE가 디코드 완료된 element 를 유지하고 있어img.complete()분기로 즉시 그려지는 패턴.수정
src/document_core/queries/rendering.rscollect()가PaintOp::RawSvg도image_count += 1처리.rhwp-studio/src/view/page-renderer.tsprefetchFlowImages가 전체 JSON 의data:image/MIME;base64,...패턴을 직접 스캔, rawSvg 내장 data URL 도 prefetch. 중복 dedupe Set 추가. 기존 image regex 유지.Test plan
cargo test --lib document_core::queries::rendering: 6 passedcargo fmt변경 파일 적용samples/한셀OLE.hwp첫 로드, 한컴 PDF 시각 비교적용 범위
PaintOp::RawSvg경로를 타는 모든 미리보기 (한셀 OLE / OOXML 차트 / EMF). 일반 그림(PaintOp::Image) 동작은 변화 없음.