File tree 2 files changed +11
-1
lines changed 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 12
12
- TypeDoc will now attempt to cache icons when ` DefaultThemeRenderContext.icons ` is overwritten by a custom theme.
13
13
Note: To perform this optimization, TypeDoc relies on ` DefaultThemeRenderContext.iconCache ` being rendered within
14
14
each page. TypeDoc does it in the ` defaultLayout ` template.
15
+ - Cache URL derivation during generation, #2386 .
15
16
16
17
### Bug Fixes
17
18
24
25
25
26
### Thanks!
26
27
28
+ - @ajesshope
27
29
- @HemalPatil
28
30
- @hrueger
29
31
- @typhonrt
Original file line number Diff line number Diff line change @@ -46,9 +46,12 @@ export abstract class ContextAwareRendererComponent extends RendererComponent {
46
46
this . listenTo ( this . owner , {
47
47
[ RendererEvent . BEGIN ] : this . onBeginRenderer ,
48
48
[ PageEvent . BEGIN ] : this . onBeginPage ,
49
+ [ RendererEvent . END ] : ( ) => this . absoluteToRelativePathMap . clear ( ) ,
49
50
} ) ;
50
51
}
51
52
53
+ private absoluteToRelativePathMap = new Map < string , string > ( ) ;
54
+
52
55
/**
53
56
* Transform the given absolute path into a relative path.
54
57
*
@@ -59,7 +62,12 @@ export abstract class ContextAwareRendererComponent extends RendererComponent {
59
62
if ( this . urlPrefix . test ( absolute ) ) {
60
63
return absolute ;
61
64
} else {
62
- return Path . posix . relative ( this . location , absolute ) || "." ;
65
+ const key = `${ this . location } :${ absolute } ` ;
66
+ let path = this . absoluteToRelativePathMap . get ( key ) ;
67
+ if ( path ) return path ;
68
+ path = Path . posix . relative ( this . location , absolute ) || "." ;
69
+ this . absoluteToRelativePathMap . set ( key , path ) ;
70
+ return path ;
63
71
}
64
72
}
65
73
You can’t perform that action at this time.
0 commit comments