mirror of
https://github.com/flarum/framework.git
synced 2025-05-22 14:49:57 +08:00
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:
@ -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
|
||||
];
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user