@@ -40,7 +40,6 @@ type NoteDetailProps = {
40
40
type NoteDetailState = {
41
41
prevStorageId : string
42
42
prevNoteId : string
43
- title : string
44
43
content : string
45
44
currentCursor : EditorPosition
46
45
currentSelections : {
@@ -53,7 +52,6 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
53
52
state : NoteDetailState = {
54
53
prevStorageId : '' ,
55
54
prevNoteId : '' ,
56
- title : '' ,
57
55
content : '' ,
58
56
currentCursor : {
59
57
line : 0 ,
@@ -86,7 +84,6 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
86
84
return {
87
85
prevStorageId : storage . id ,
88
86
prevNoteId : note . _id ,
89
- title : note . title ,
90
87
content : note . content ,
91
88
currentCursor : {
92
89
line : 0 ,
@@ -113,9 +110,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
113
110
const { note } = this . props
114
111
if ( prevState . prevNoteId !== note . _id ) {
115
112
if ( this . queued ) {
116
- const { title , content } = prevState
113
+ const { content } = prevState
117
114
this . saveNote ( prevState . prevStorageId , prevState . prevNoteId , {
118
- title,
119
115
content,
120
116
} )
121
117
}
@@ -124,9 +120,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
124
120
125
121
componentWillUnmount ( ) {
126
122
if ( this . queued ) {
127
- const { title , content, prevStorageId, prevNoteId } = this . state
123
+ const { content, prevStorageId, prevNoteId } = this . state
128
124
this . saveNote ( prevStorageId , prevNoteId , {
129
- title,
130
125
content,
131
126
} )
132
127
}
@@ -155,9 +150,8 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
155
150
const { note, storage } = this . props
156
151
157
152
if ( this . queued ) {
158
- const { title , content } = this . state
153
+ const { content } = this . state
159
154
await this . saveNote ( storage . id , note . _id , {
160
- title,
161
155
content,
162
156
} )
163
157
}
@@ -173,10 +167,9 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
173
167
}
174
168
this . timer = setTimeout ( ( ) => {
175
169
const { note, storage } = this . props
176
- const { title , content } = this . state
170
+ const { content } = this . state
177
171
178
172
this . saveNote ( storage . id , note . _id , {
179
- title,
180
173
content,
181
174
} )
182
175
} , 3000 )
@@ -185,14 +178,13 @@ class NoteDetail extends React.Component<NoteDetailProps, NoteDetailState> {
185
178
async saveNote (
186
179
storageId : string ,
187
180
noteId : string ,
188
- { title , content } : { title : string ; content : string }
181
+ { content } : { content : string }
189
182
) {
190
183
clearTimeout ( this . timer )
191
184
this . queued = false
192
185
193
186
const { updateNote } = this . props
194
187
await updateNote ( storageId , noteId , {
195
- title,
196
188
content,
197
189
} )
198
190
}
0 commit comments