Skip to content

Commit d1b9859

Browse files
JoviDeCroockmarvinhagemeister
authored andcommitted
Improve performance by skipping dirty checks for effects alltogether
1 parent 1da1bdb commit d1b9859

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const SHALLOW = { shallow: true };
1414

1515
// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.
1616
const UNNAMED = [];
17+
const _skipEffects = '__s';
1718

1819
const VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;
1920

@@ -47,10 +48,15 @@ const EMPTY_ARR = [];
4748
function renderToString(vnode, context, opts) {
4849
context = context || {};
4950
opts = opts || {};
51+
52+
const previousSkipEffects = options[_skipEffects];
53+
options[_skipEffects] = true;
54+
5055
const res = _renderToString(vnode, context, opts);
5156
// options._commit, we don't schedule any effects in this library right now,
5257
// so we can pass an empty queue to this hook.
5358
if (options.__c) options.__c(vnode, EMPTY_ARR);
59+
options[_skipEffects] = previousSkipEffects;
5460
return res;
5561
}
5662

0 commit comments

Comments
 (0)