Skip to content

Commit

Permalink
lock locker
Browse files Browse the repository at this point in the history
  • Loading branch information
koki-develop committed Mar 26, 2023
1 parent 8ef6e26 commit d00ccf9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func (m *model) Init() tea.Cmd {
*/

func (m *model) View() string {
if m.option.hotReloadLocker != nil {
m.option.hotReloadLocker.Lock()
defer m.option.hotReloadLocker.Unlock()
}

var v strings.Builder

_, _ = v.WriteString(m.headerView())
Expand Down Expand Up @@ -254,6 +259,10 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
}
if beforeValue != m.input.Value() {
if m.option.hotReloadLocker != nil {
m.option.hotReloadLocker.Lock()
defer m.option.hotReloadLocker.Unlock()
}
m.filter()
m.fixYPosition()
m.fixCursor()
Expand Down

0 comments on commit d00ccf9

Please sign in to comment.