1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-17 19:51:42 +00:00

Fix noteCount on a note trased

This commit is contained in:
asmsuechan
2017-08-05 17:16:57 +09:00
parent 8df867046f
commit d6280f4397

View File

@@ -180,14 +180,20 @@ class StorageItem extends React.Component {
render () { render () {
let { storage, location, isFolded, data, dispatch } = this.props let { storage, location, isFolded, data, dispatch } = this.props
let { folderNoteMap } = data let { folderNoteMap, trashedSet } = data
let folderList = storage.folders.map((folder) => { let folderList = storage.folders.map((folder) => {
let isActive = !!(location.pathname.match(new RegExp('\/storages\/' + storage.key + '\/folders\/' + folder.key))) let isActive = !!(location.pathname.match(new RegExp('\/storages\/' + storage.key + '\/folders\/' + folder.key)))
let noteSet = folderNoteMap.get(storage.key + '-' + folder.key) let noteSet = folderNoteMap.get(storage.key + '-' + folder.key)
let noteCount = noteSet != null let noteCount = 0
? noteSet.size if (noteSet) {
: 0 let trashedNoteCount = 0
const noteKeys = noteSet.map(noteKey => { return noteKey })
noteKeys.forEach(noteKey => {
if (trashedSet.toJS().some(trashedKey => { return noteKey === trashedKey })) trashedNoteCount++
})
noteCount = noteSet.size - trashedNoteCount
}
return ( return (
<StorageItemChild <StorageItemChild
key={folder.key} key={folder.key}