Commit 626c5b6
authored
fix: reload highlighter when language is available (#2601)
* fix: reload highlighter when language is available
- add language to list of deps, to trigger a re-render once available
- persist highlighter loader in a ref, to avoid unnecessary rerenders
- memoize language computation from className
* prevent loading the highlighter when component unmounts; remove import caching; stabilize CodeSkeleton
- import caching is not needed as dynamic from nextjs already does that
- CodeSkeleton depends on changing props, they're now part of the callback dependencies
* remove unnecessary deps from loadHighlighter callback1 parent 1342317 commit 626c5b6
1 file changed
+19
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
| |||
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
275 | | - | |
| 279 | + | |
| 280 | + | |
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
283 | 290 | | |
284 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
285 | 296 | | |
286 | | - | |
| 297 | + | |
287 | 298 | | |
288 | 299 | | |
289 | 300 | | |
| |||
0 commit comments