[FIX] component: reuse widget if possible

Previous code always destroy and recreate widgets.
This commit is contained in:
Géry Debongnie
2019-06-01 21:44:43 +02:00
committed by VincentSchippefilt
parent 8dc3ec94bf
commit 466c12a0e6
5 changed files with 155 additions and 51 deletions
+9
View File
@@ -99,6 +99,7 @@ const NODE_HOOKS_PARAMS = {
interface Utils {
h: typeof h;
objectToAttrString(obj: Object): string;
shallowEqual(p1: Object, p2: Object): boolean;
[key: string]: any;
}
@@ -112,6 +113,14 @@ export const UTILS: Utils = {
}
}
return classes.join(" ");
},
shallowEqual(p1, p2) {
for (let k in p1) {
if (p1[k] !== p2[k]) {
return false;
}
}
return true;
}
};