From 702c4cb12146d4b3d18807d56e013da3aed15836 Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 29 Nov 2016 12:15:46 -0300 Subject: Fix more react warnings & fix saving theme (#4667) --- webapp/actions/user_actions.jsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'webapp/actions') diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 455ca1730..a93f84e7c 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -236,7 +236,7 @@ function onThemeSaved(teamId, theme, onSuccess) { const toDelete = []; for (const [name] of themePreferences) { - if (name === '') { + if (name === '' || name === teamId) { continue; } @@ -247,14 +247,16 @@ function onThemeSaved(teamId, theme, onSuccess) { }); } - // we're saving a new global theme so delete any team-specific ones - AsyncClient.deletePreferences(toDelete); + if (toDelete.length > 0) { + // we're saving a new global theme so delete any team-specific ones + AsyncClient.deletePreferences(toDelete); - // delete them locally before we hear from the server so that the UI flow is smoother - AppDispatcher.handleServerAction({ - type: ActionTypes.DELETED_PREFERENCES, - preferences: toDelete - }); + // delete them locally before we hear from the server so that the UI flow is smoother + AppDispatcher.handleServerAction({ + type: ActionTypes.DELETED_PREFERENCES, + preferences: toDelete + }); + } onSuccess(); } -- cgit v1.2.3-1-g7c22