Skip to content

Commit 21ccfab

Browse files
committed
Fix title bug
1 parent 06e0abf commit 21ccfab

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/components/organisms/NoteDetail.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type NoteDetailProps = {
4040
type NoteDetailState = {
4141
prevStorageId: string
4242
prevNoteId: string
43-
title: string
4443
content: string
4544
currentCursor: EditorPosition
4645
currentSelections: {
@@ -53,7 +52,6 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
5352
state: NoteDetailState = {
5453
prevStorageId: '',
5554
prevNoteId: '',
56-
title: '',
5755
content: '',
5856
currentCursor: {
5957
line: 0,
@@ -86,7 +84,6 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
8684
return {
8785
prevStorageId: storage.id,
8886
prevNoteId: note._id,
89-
title: note.title,
9087
content: note.content,
9188
currentCursor: {
9289
line: 0,
@@ -113,9 +110,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
113110
const { note } = this.props
114111
if (prevState.prevNoteId !== note._id) {
115112
if (this.queued) {
116-
const { title, content } = prevState
113+
const { content } = prevState
117114
this.saveNote(prevState.prevStorageId, prevState.prevNoteId, {
118-
title,
119115
content,
120116
})
121117
}
@@ -124,9 +120,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
124120

125121
componentWillUnmount() {
126122
if (this.queued) {
127-
const { title, content, prevStorageId, prevNoteId } = this.state
123+
const { content, prevStorageId, prevNoteId } = this.state
128124
this.saveNote(prevStorageId, prevNoteId, {
129-
title,
130125
content,
131126
})
132127
}
@@ -155,9 +150,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
155150
const { note, storage } = this.props
156151

157152
if (this.queued) {
158-
const { title, content } = this.state
153+
const { content } = this.state
159154
await this.saveNote(storage.id, note._id, {
160-
title,
161155
content,
162156
})
163157
}
@@ -173,10 +167,9 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
173167
}
174168
this.timer = setTimeout(() => {
175169
const { note, storage } = this.props
176-
const { title, content } = this.state
170+
const { content } = this.state
177171

178172
this.saveNote(storage.id, note._id, {
179-
title,
180173
content,
181174
})
182175
}, 3000)
@@ -185,14 +178,13 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
185178
async saveNote(
186179
storageId: string,
187180
noteId: string,
188-
{ title, content }: { title: string; content: string }
181+
{ content }: { content: string }
189182
) {
190183
clearTimeout(this.timer)
191184
this.queued = false
192185

193186
const { updateNote } = this.props
194187
await updateNote(storageId, noteId, {
195-
title,
196188
content,
197189
})
198190
}

0 commit comments

Comments
 (0)