Patch Mithril bug causing redraws to fail

Turns out there's a little more to the regression in e5a7013. First, we need to give the spaces in between list items a key too. Second, there's a bug in the latest Mithril code where using string keys can break the diffing algorithm. I've patched it manually in our dist JS files for now, and reported the issue: https://github.com/lhorie/mithril.js/issues/934
This commit is contained in:
Toby Zerner
2016-01-19 18:55:57 +10:30
parent 60d78cedef
commit 3cec7e8b46
3 changed files with 20 additions and 12 deletions

View File

@ -35,9 +35,13 @@ export default function listItems(items) {
const className = item.props ? item.props.itemClassName : item.itemClassName;
if (isListItem) {
item.props.key = item.itemName;
item.attrs = item.attrs || {};
item.attrs.key = item.attrs.key || item.itemName;
}
const space = new String(' ');
space.attrs = {key: '_space_'+item.itemName};
return [
isListItem
? item
@ -49,7 +53,7 @@ export default function listItems(items) {
key={item.itemName}>
{item}
</li>,
' '
space
];
});
}