Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clearing tx initial message before the page change is made #861

Merged
merged 3 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version

* [fix] Fix initial message input clearing too early in checkout page.
[#861](https://github.com/sharetribe/flex-template-web/pull/861)
* [fix] Fix setting Topbar search input initial value.
[#857](https://github.com/sharetribe/flex-template-web/pull/857)

Expand Down
9 changes: 4 additions & 5 deletions src/forms/StripePaymentForm/StripePaymentForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class StripePaymentForm extends Component {
}
});
}
componentWillReceiveProps() {
this.setState(initialState);
}
componentWillUnmount() {
if (this.card) {
this.card.removeEventListener('change', this.handleCardValueChange);
Expand Down Expand Up @@ -202,7 +199,7 @@ class StripePaymentForm extends Component {
const classes = classNames(rootClassName || css.root, className);
const cardClasses = classNames(css.card, {
[css.cardSuccess]: this.state.cardValueValid,
[css.cardError]: this.state.error,
[css.cardError]: this.state.error && !submitInProgress,
});

const messagePlaceholder = intl.formatMessage(
Expand Down Expand Up @@ -243,7 +240,9 @@ class StripePaymentForm extends Component {
this.cardContainer = el;
}}
/>
{this.state.error ? <span style={{ color: 'red' }}>{this.state.error}</span> : null}
{this.state.error && !submitInProgress ? (
<span style={{ color: 'red' }}>{this.state.error}</span>
) : null}
<h3 className={css.messageHeading}>
<FormattedMessage id="StripePaymentForm.messageHeading" />
</h3>
Expand Down