Skip to content

Commit

Permalink
fix(define): keep lastValue for HMR update
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban committed May 5, 2021
1 parent c155fed commit bdff4c0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/define.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,18 @@ function update(Hybrid, lastHybrids) {
deferred.then(() => {
walkInShadow(document.body, node => {
if (updateQueue.has(node.constructor)) {
const hybrids = updateQueue.get(node.constructor);
const prevHybrids = updateQueue.get(node.constructor);
const hybrids = node.constructor.hybrids;
node.disconnectedCallback();

Object.keys(node.constructor.hybrids).forEach(key => {
Object.keys(hybrids).forEach(key => {
const type = typeof hybrids[key];
cache.invalidate(
node,
key,
node.constructor.hybrids[key] !== hybrids[key],
type !== "object" &&
type !== "function" &&
hybrids[key] !== prevHybrids[key],
);
});

Expand Down

0 comments on commit bdff4c0

Please sign in to comment.