Bug 1110155 - Fixed renamed Loop room not reflected into the panel. r=Standard8

This commit is contained in:
Nicolas Perriault 2014-12-23 11:54:32 +01:00
parent 45b84ba902
commit 462f9de768
3 changed files with 18 additions and 3 deletions

View File

@ -568,7 +568,14 @@ loop.panel = (function(_, mozL10n) {
handleFormSubmit: function(event) { handleFormSubmit: function(event) {
event.preventDefault(); event.preventDefault();
this.props.onChange(this.state.text); // While we already validate for a non-empty string in the store, we need
// to check it at the component level to avoid desynchronized rendering
// issues.
if (this.state.text.trim()) {
this.props.onChange(this.state.text);
} else {
this.setState({text: this.props.text});
}
this.setState({edit: false}); this.setState({edit: false});
}, },

View File

@ -568,7 +568,14 @@ loop.panel = (function(_, mozL10n) {
handleFormSubmit: function(event) { handleFormSubmit: function(event) {
event.preventDefault(); event.preventDefault();
this.props.onChange(this.state.text); // While we already validate for a non-empty string in the store, we need
// to check it at the component level to avoid desynchronized rendering
// issues.
if (this.state.text.trim()) {
this.props.onChange(this.state.text);
} else {
this.setState({text: this.props.text});
}
this.setState({edit: false}); this.setState({edit: false});
}, },

View File

@ -423,10 +423,11 @@ loop.store = loop.store || {};
* @param {sharedActions.RenameRoom} actionData * @param {sharedActions.RenameRoom} actionData
*/ */
renameRoom: function(actionData) { renameRoom: function(actionData) {
var oldRoomName = this.getStoreState("roomName");
var newRoomName = actionData.newRoomName.trim(); var newRoomName = actionData.newRoomName.trim();
// Skip update if name is unchanged or empty. // Skip update if name is unchanged or empty.
if (!newRoomName || this.getStoreState("roomName") === newRoomName) { if (!newRoomName || oldRoomName === newRoomName) {
return; return;
} }