bugfix persisted state issue (#228)

* bugfix persisted state issue

* bugfix and also set defaults properly
This commit is contained in:
mayeaux 2021-11-05 16:45:19 +01:00 committed by GitHub
parent 21e1af8ce5
commit 6cb011ff96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -117,7 +117,7 @@ export function CommentCreate(props: Props) {
const [commentValue, setCommentValue] = React.useState('');
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
const [stickerSelector, setStickerSelector] = React.useState();
const [activeTab, setActiveTab] = React.useState('');
const [activeTab, setActiveTab] = React.useState();
const [tipError, setTipError] = React.useState();
const [deletedComment, setDeletedComment] = React.useState(false);
const [pauseQuickSend, setPauseQuickSend] = React.useState(false);

View file

@ -65,11 +65,21 @@ function WalletSendTip(props: Props) {
const [tipAmount, setTipAmount] = usePersistedState('comment-support:customTip', 1.0);
const [isOnConfirmationPage, setConfirmationPage] = React.useState(false);
const [tipError, setTipError] = React.useState();
const [activeTab, setActiveTab] = usePersistedState(TAB_BOOST);
const [activeTab, setActiveTab] = usePersistedState();
const [disableSubmitButton, setDisableSubmitButton] = React.useState();
/** CONSTS **/
// if not proper default is set, set the proper default
if (activeTab !== TAB_BOOST && activeTab !== TAB_LBC && activeTab !== TAB_FIAT) {
// if the claim is the user's set it to boost
if (claimIsMine) {
setActiveTab(TAB_BOOST);
} else {
// otherwise set it to tip lbc as default
setActiveTab(TAB_LBC);
}
}
/** CONSTS **/
const claimTypeText = getClaimTypeText();
const isSupport = claimIsMine || activeTab === TAB_BOOST;
const titleText = claimIsMine