1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-22 06:01:45 +00:00

Fix file list blinking on search

This commit is contained in:
Shammasov Max
2018-06-11 03:46:39 +03:00
parent 3a90a078ce
commit 2631cc3747
3 changed files with 20 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import debounceRender from 'react-debounce-render'
import styles from './NoteList.styl'
import moment from 'moment'
import _ from 'lodash'
@@ -947,16 +948,24 @@ class NoteList extends React.Component {
})
const viewType = this.getViewType()
const autoSelectFirst = notes.length === 1
|| selectedNoteKeys.length === 0
|| notes.every( note => !selectedNoteKeys.includes(note.key))
const noteList = notes
.map(note => {
.map( (note, index) => {
if (note == null) {
return null
}
const isDefault = config.listStyle === 'DEFAULT'
const uniqueKey = getNoteKey(note)
const isActive = selectedNoteKeys.includes(uniqueKey)
const isActive =
selectedNoteKeys.includes(uniqueKey)
|| notes.length === 1
|| (autoSelectFirst && index === 0)
const dateDisplay = moment(
config.sortBy === 'CREATED_AT'
? note.createdAt : note.updatedAt
@@ -1058,4 +1067,4 @@ NoteList.propTypes = {
})
}
export default CSSModules(NoteList, styles)
export default debounceRender(CSSModules(NoteList, styles))