From 1e997a6f0dc3340c5b5da0f4338dc4ab1f5742f5 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Tue, 30 Apr 2024 15:53:05 +0530 Subject: [PATCH] fix title not saving on blur --- src/components/app.jsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/app.jsx b/src/components/app.jsx index 9f6bb63..2db7cb0 100644 --- a/src/components/app.jsx +++ b/src/components/app.jsx @@ -1029,14 +1029,17 @@ export default class App extends Component { } titleInputBlurHandler(e) { - this.setState({ - currentItem: { ...this.state.currentItem, title: e.target.value } - }); - - if (this.state.currentItem.id) { - this.saveItem(); - trackEvent('ui', 'titleChanged'); - } + this.setState( + { + currentItem: { ...this.state.currentItem, title: e.target.value } + }, + () => { + if (this.state.currentItem.id) { + this.saveItem(); + trackEvent('ui', 'titleChanged'); + } + } + ); } /**