@@ -338,11 +338,11 @@ export default class SendMessageComposer extends React.Component {
338338 const parts = this . _restoreStoredEditorState ( partCreator ) || [ ] ;
339339 this . model = new EditorModel ( parts , partCreator ) ;
340340 this . dispatcherRef = dis . register ( this . onAction ) ;
341- this . sendHistoryManager = new SendHistoryManager ( this . props . room . roomId , 'mx_cider_composer_history_ ' ) ;
341+ this . sendHistoryManager = new SendHistoryManager ( this . props . room . roomId , 'mx_cider_history_ ' ) ;
342342 }
343343
344344 get _editorStateKey ( ) {
345- return `cider_editor_state_ ${ this . props . room . roomId } ` ;
345+ return `mx_cider_state_ ${ this . props . room . roomId } ` ;
346346 }
347347
348348 _clearStoredEditorState ( ) {
@@ -352,15 +352,19 @@ export default class SendMessageComposer extends React.Component {
352352 _restoreStoredEditorState ( partCreator ) {
353353 const json = localStorage . getItem ( this . _editorStateKey ) ;
354354 if ( json ) {
355- const { parts : serializedParts , replyEventId} = SendHistoryManager . parseItem ( JSON . parse ( json ) ) ;
356- const parts = serializedParts . map ( p => partCreator . deserializePart ( p ) ) ;
357- if ( replyEventId ) {
358- dis . dispatch ( {
359- action : 'reply_to_event' ,
360- event : this . props . room . findEventById ( replyEventId ) ,
361- } ) ;
355+ try {
356+ const { parts : serializedParts , replyEventId} = JSON . parse ( json ) ;
357+ const parts = serializedParts . map ( p => partCreator . deserializePart ( p ) ) ;
358+ if ( replyEventId ) {
359+ dis . dispatch ( {
360+ action : 'reply_to_event' ,
361+ event : this . props . room . findEventById ( replyEventId ) ,
362+ } ) ;
363+ }
364+ return parts ;
365+ } catch ( e ) {
366+ console . error ( e ) ;
362367 }
363- return parts ;
364368 }
365369 }
366370
0 commit comments