mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 17:41:33 +03:00
Merge pull request #3208 from lukechampine/save-chat-input
chat-js: store unsent message only on unmount
This commit is contained in:
commit
cdf748531d
@ -596,7 +596,7 @@ export class ChatScreen extends Component<ChatScreenProps, ChatScreenState> {
|
||||
envelopes={props.envelopes}
|
||||
contacts={props.contacts}
|
||||
onEnter={() => this.setState({ scrollLocked: false })}
|
||||
onChange={(msg: string) => this.setState({
|
||||
onUnmount={(msg: string) => this.setState({
|
||||
messages: this.state.messages.set(props.station, msg)
|
||||
})}
|
||||
s3={props.s3}
|
||||
|
@ -40,7 +40,7 @@ export class ChatInput extends Component {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
message: '',
|
||||
message: props.message,
|
||||
patpSearch: null
|
||||
};
|
||||
|
||||
@ -99,6 +99,10 @@ export class ChatInput extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.onUnmount(this.state.message);
|
||||
}
|
||||
|
||||
nextAutocompleteSuggestion(backward = false) {
|
||||
const { patpSuggestions } = this.state;
|
||||
let idx = patpSuggestions.findIndex(s => s === this.state.selectedSuggestion);
|
||||
@ -150,7 +154,9 @@ export class ChatInput extends Component {
|
||||
if(patpSearch !== null) {
|
||||
this.patpAutocomplete(value, false);
|
||||
}
|
||||
this.props.onChange(value);
|
||||
this.setState({
|
||||
message: value
|
||||
});
|
||||
}
|
||||
|
||||
getLetterType(letter) {
|
||||
|
Loading…
Reference in New Issue
Block a user