@@ -70,18 +70,22 @@ export const LandingPage = ({
7070 if ( stored ) {
7171 hasRestoredPendingMessage . current = true ;
7272 sessionStorage . removeItem ( PENDING_MESSAGE_KEY ) ;
73- const message = JSON . parse ( stored ) as Descendant [ ] ;
73+ try {
74+ const message = JSON . parse ( stored ) as Descendant [ ] ;
7475
75- // Restore the message content to the editor by replacing all nodes
76- // Remove all existing nodes
77- while ( editor . children . length > 0 ) {
78- Transforms . removeNodes ( editor , { at : [ 0 ] } ) ;
79- }
80- // Insert the restored content at the beginning
81- Transforms . insertNodes ( editor , message , { at : [ 0 ] } ) ;
76+ // Restore the message content to the editor by replacing all nodes
77+ // Remove all existing nodes
78+ while ( editor . children . length > 0 ) {
79+ Transforms . removeNodes ( editor , { at : [ 0 ] } ) ;
80+ }
81+ // Insert the restored content at the beginning
82+ Transforms . insertNodes ( editor , message , { at : [ 0 ] } ) ;
8283
83- // Allow the UI to render the restored text before auto-submitting
84- createNewChatThread ( message , selectedSearchScopes ) ;
84+ // Allow the UI to render the restored text before auto-submitting
85+ createNewChatThread ( message , selectedSearchScopes ) ;
86+ } catch ( error ) {
87+ console . error ( 'Failed to restore pending message:' , error ) ;
88+ }
8589 }
8690 }
8791 } , [ isAuthenticated , editor , createNewChatThread , selectedSearchScopes ] ) ;
@@ -130,7 +134,7 @@ export const LandingPage = ({
130134 repos = { [ ] }
131135 searchContexts = { [ ] }
132136 selectedSearchScopes = { selectedSearchScopes }
133- onSelectedSearchScopesChange = { ( ) => { } }
137+ onSelectedSearchScopesChange = { ( ) => { } }
134138 isContextSelectorOpen = { isContextSelectorOpen }
135139 onContextSelectorOpenChanged = { setIsContextSelectorOpen }
136140 />
0 commit comments