Matt-Esch/virtual-dom

bug: virtual-dom does not notice regex props changes

0x24a537r9 opened this issue · 0 comments

If I have a regex prop, virtual-dom will never update it. See http://requirebin.com/?gist=013435cf5fc871d9f7b81eac75a94d1e or below:

var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var prettyFormat = require('pretty-format');

const before = h('div', {}, [
  h('div', {regex: /a/}, null),
]);
const after = h('div', {}, [
  h('div', {regex: /b/}, null),
]);

console.info(prettyFormat(diff(before, after)));

logs:

Object {
  "a": VirtualNode {
    "children": Array [
      VirtualNode {
        "children": Array [],
        "count": 0,
        "descendantHooks": false,
        "hasThunks": false,
        "hasWidgets": false,
        "hooks": undefined,
        "key": undefined,
        "namespace": null,
        "properties": Object {
          "regex": /a/,
        },
        "tagName": "DIV",
      },
    ],
    "count": 1,
    "descendantHooks": false,
    "hasThunks": false,
    "hasWidgets": false,
    "hooks": undefined,
    "key": undefined,
    "namespace": null,
    "properties": Object {},
    "tagName": "DIV",
  },
}

Note the lack of patches. I would expect a PROPS patch at index 0 for the regex prop.