Skip to content

Commit 830ade9

Browse files
authored
Merge pull request #2399 from Pudge601/bug/2241
Clear search when a new note is created
2 parents a6eddb5 + 6510152 commit 830ade9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

browser/main/NoteList/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,15 @@ class NoteList extends React.Component {
173173
}
174174
}
175175

176-
focusNote (selectedNoteKeys, noteKey) {
176+
focusNote (selectedNoteKeys, noteKey, pathname) {
177177
const { router } = this.context
178-
const { location } = this.props
179178

180179
this.setState({
181180
selectedNoteKeys
182181
})
183182

184183
router.push({
185-
pathname: location.pathname,
184+
pathname,
186185
query: {
187186
key: noteKey
188187
}
@@ -201,6 +200,7 @@ class NoteList extends React.Component {
201200
}
202201
let { selectedNoteKeys } = this.state
203202
const { shiftKeyDown } = this.state
203+
const { location } = this.props
204204

205205
let targetIndex = this.getTargetIndex()
206206

@@ -217,7 +217,7 @@ class NoteList extends React.Component {
217217
selectedNoteKeys.push(priorNoteKey)
218218
}
219219

220-
this.focusNote(selectedNoteKeys, priorNoteKey)
220+
this.focusNote(selectedNoteKeys, priorNoteKey, location.pathname)
221221

222222
ee.emit('list:moved')
223223
}
@@ -228,6 +228,7 @@ class NoteList extends React.Component {
228228
}
229229
let { selectedNoteKeys } = this.state
230230
const { shiftKeyDown } = this.state
231+
const { location } = this.props
231232

232233
let targetIndex = this.getTargetIndex()
233234
const isTargetLastNote = targetIndex === this.notes.length - 1
@@ -250,7 +251,7 @@ class NoteList extends React.Component {
250251
selectedNoteKeys.push(nextNoteKey)
251252
}
252253

253-
this.focusNote(selectedNoteKeys, nextNoteKey)
254+
this.focusNote(selectedNoteKeys, nextNoteKey, location.pathname)
254255

255256
ee.emit('list:moved')
256257
}
@@ -262,7 +263,7 @@ class NoteList extends React.Component {
262263
}
263264

264265
const selectedNoteKeys = [noteHash]
265-
this.focusNote(selectedNoteKeys, noteHash)
266+
this.focusNote(selectedNoteKeys, noteHash, '/home')
266267

267268
ee.emit('list:moved')
268269
}

0 commit comments

Comments
 (0)