File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,21 @@ const EMPTY_ARR = [];
47
47
function renderToString ( vnode , context , opts ) {
48
48
context = context || { } ;
49
49
opts = opts || { } ;
50
+
51
+ // Performance optimization: `renderToString` is synchronous and we
52
+ // therefore don't execute any effects. To do that we pass an empty
53
+ // array to `options._commit` (`__c`). But we can go one step further
54
+ // and avoid a lot of dirty checks and allocations by setting
55
+ // `options._skipEffects` (`__s`) too.
56
+ const previousSkipEffects = options . __s ;
57
+ options . __s = true ;
58
+
50
59
const res = _renderToString ( vnode , context , opts ) ;
60
+
51
61
// options._commit, we don't schedule any effects in this library right now,
52
62
// so we can pass an empty queue to this hook.
53
63
if ( options . __c ) options . __c ( vnode , EMPTY_ARR ) ;
64
+ options . __s = previousSkipEffects ;
54
65
return res ;
55
66
}
56
67
You can’t perform that action at this time.
0 commit comments