Skip to content
This repository was archived by the owner on Oct 14, 2018. It is now read-only.

Support server side rendering #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ Cursor.build = build;

Cursor.debug = false;

Cursor.dispose = util.clearCache;

module.exports = Cursor;
11 changes: 9 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function refToHash (cmp) {
}
}

var cache = {};
function memoizeFactory (resolver) {
var cache = {};
function memoize(func) {
return function () {
var key = resolver ? resolver.apply(this, arguments) : arguments[0];
Expand All @@ -120,6 +120,12 @@ function memoizeFactory (resolver) {
return memoize;
}

function clearCache() {
cache = {};
refsCache = {};
cacheIdIndex = 0;
}

module.exports = {
getRefAtPath: getRefAtPath,
deref: deref,
Expand All @@ -136,5 +142,6 @@ module.exports = {
isEqual: isEqual,
union: union,
omit: omit,
find: find
find: find,
clearCache: clearCache
};