Commit 9d1c503
authored
fix: markdown thumbnail capture race condition — use MutationObserver instead of setTimeout (#236)
DomCapture used setTimeout(500ms) to wait for ReactMarkdown to render
before capturing. This was a race condition — rendering could take longer,
producing blank thumbnails.
Replace with a MutationObserver that waits for actual rendered elements
(p, h1-h3, li, pre, blockquote, table) to appear in the DOM, then
captures after one requestAnimationFrame for layout to settle. SVG
content (set synchronously via dangerouslySetInnerHTML) is caught by
an initial check before the observer is attached.
Also add mock PUT /assets/:id/thumbnail handlers so thumbnail capture
can be tested end-to-end in dev mode with MSW.1 parent a6ebb94 commit 9d1c503
2 files changed
+38
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
200 | 217 | | |
201 | 218 | | |
202 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
682 | 691 | | |
683 | 692 | | |
684 | 693 | | |
| |||
807 | 816 | | |
808 | 817 | | |
809 | 818 | | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
810 | 828 | | |
811 | 829 | | |
812 | 830 | | |
| |||
0 commit comments