Skip to content

Commit

Permalink
Fix a few cases where refs were invoked with the wrong value. Fixes #87.
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Mar 12, 2016
1 parent 6e06b51 commit cee2a43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/vdom/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function renderComponent(component, opts) {
}

if (component.base || (opts && opts.build)) {
base = diff(cbase, rendered || EMPTY_BASE, childContext, component);
base = diff(cbase, rendered || EMPTY_BASE, childContext);
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/vdom/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { createNode, collectNode } from '../dom/recycler';
* @returns {Element} dom The created/mutated element
* @private
*/
export default function diff(dom, vnode, context, component) {
export default function diff(dom, vnode, context) {
let originalAttributes = vnode.attributes;

while (isFunctionalComponent(vnode)) {
vnode = buildFunctionalComponent(vnode, context);
}
Expand Down Expand Up @@ -60,9 +62,9 @@ export default function diff(dom, vnode, context, component) {

innerDiffNode(out, vnode, context);

let attrs = vnode.attributes,
c = out._component;
if (attrs) hook(attrs, 'ref', (!component || c===component) && c || out);
if (originalAttributes && originalAttributes.ref) {
(out[ATTR_KEY].ref = originalAttributes.ref)(out);
}

return out;
}
Expand Down

0 comments on commit cee2a43

Please sign in to comment.