You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			20 lines
		
	
	
		
			579 B
		
	
	
	
		
			TypeScript
		
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			579 B
		
	
	
	
		
			TypeScript
		
	
| 
											4 years ago
										 | // keep this draft state local to not have to do a redux state update (a bit slow with our large state for some computers)
 | ||
|  | const draftsForConversations: Record<string, string> = {}; | ||
|  | 
 | ||
|  | export function getDraftForConversation(conversationKey?: string) { | ||
|  |   if (!conversationKey || !draftsForConversations[conversationKey]) { | ||
|  |     return ''; | ||
|  |   } | ||
|  |   return draftsForConversations[conversationKey] || ''; | ||
|  | } | ||
|  | 
 | ||
|  | export function updateDraftForConversation({ | ||
|  |   conversationKey, | ||
|  |   draft, | ||
|  | }: { | ||
|  |   conversationKey: string; | ||
|  |   draft: string; | ||
|  | }) { | ||
|  |   draftsForConversations[conversationKey] = draft; | ||
|  | } |