From 06abccabb4de53832a12f504e7c1c01b3ef788d3 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 7 May 2018 18:26:37 +0200 Subject: [PATCH] Fix InputField controlled / uncontrolled mode --- .../client/components/ChangePassword.js | 6 +++++- .../client/components/InputField.js | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js index 8f86fff48..a375e90a4 100644 --- a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js +++ b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js @@ -14,7 +14,11 @@ const initialState = { editing: false, showErrors: true, errors: {}, - formData: {}, + formData: { + oldPassword: '', + newPassword: '', + confirmNewPassword: '', + }, }; class ChangePassword extends React.Component { diff --git a/plugins/talk-plugin-local-auth/client/components/InputField.js b/plugins/talk-plugin-local-auth/client/components/InputField.js index 930c15582..7dca22197 100644 --- a/plugins/talk-plugin-local-auth/client/components/InputField.js +++ b/plugins/talk-plugin-local-auth/client/components/InputField.js @@ -19,13 +19,13 @@ const InputField = ({ showSuccess = false, validationType = '', icon = '', - value = '', - defaultValue = '', + value, + defaultValue, disabled = false, }) => { const inputValue = { - ...(value ? { value } : {}), - ...(defaultValue ? { defaultValue } : {}), + ...(value !== undefined ? { value } : {}), + ...(defaultValue !== undefined ? { defaultValue } : {}), }; return (