Reactivity fixes for attachments.

This commit is contained in:
Roger Braun 2016-12-01 18:05:20 +01:00
parent 0df3ca47a4
commit 4c5d60ab85

View file

@ -45,6 +45,9 @@ export const prepareStatus = (status) => {
status.nsfw = !!status.text.match(nsfwRegex) status.nsfw = !!status.text.match(nsfwRegex)
} }
// To make the array reactive
status.attachments = status.attachments || []
return status return status
} }
@ -77,6 +80,8 @@ const mergeOrAdd = (arr, item) => {
if (oldItem) { if (oldItem) {
// We already have this, so only merge the new info. // We already have this, so only merge the new info.
merge(oldItem, item) merge(oldItem, item)
// Reactivity fix.
oldItem.attachments.splice(oldItem.attachments.length)
return {item: oldItem, new: false} return {item: oldItem, new: false}
} else { } else {
// This is a new item, prepare it // This is a new item, prepare it