'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});
exports['default'] = performElementUpdate;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _virtualDomDiff = require('virtual-dom/diff');

var _virtualDomDiff2 = _interopRequireDefault(_virtualDomDiff);

var _virtualDomPatch = require('virtual-dom/patch');

var _virtualDomPatch2 = _interopRequireDefault(_virtualDomPatch);

var _refsStack = require('./refs-stack');

var _refsStack2 = _interopRequireDefault(_refsStack);

function performElementUpdate(component) {
  var oldVirtualElement = component.virtualElement;
  var newVirtualElement = component.render();
  _refsStack2['default'].push(component.refs);
  (0, _virtualDomPatch2['default'])(component.element, (0, _virtualDomDiff2['default'])(oldVirtualElement, newVirtualElement));
  _refsStack2['default'].pop();
  component.virtualElement = newVirtualElement;
}

module.exports = exports['default'];