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

Change clearErrors action to resetState #865

Merged
merged 2 commits into from
Jul 10, 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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version

* [fix] Fix submit button state on contact details page
* [fix] Fix TransactionPage state management in loadData.
[#863](https://github.com/sharetribe/flex-template-web/pull/863) & [#865](https://github.com/sharetribe/flex-template-web/pull/865)
* [fix] Fix submit button state on contact details page.
[#864](https://github.com/sharetribe/flex-template-web/pull/864)
* [fix] Fix passing initial message sending error to transaction page.
[#863](https://github.com/sharetribe/flex-template-web/pull/863)
Expand Down
10 changes: 5 additions & 5 deletions src/containers/TransactionPage/TransactionPage.duck.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CUSTOMER = 'customer';

export const SET_INITAL_VALUES = 'app/TransactionPage/SET_INITIAL_VALUES';

export const CLEAR_ERRORS = 'app/TransactionPage/CLEAR_ERRORS';
export const RESET_STATE = 'app/TransactionPage/RESET_STATE';

export const FETCH_TRANSACTION_REQUEST = 'app/TransactionPage/FETCH_TRANSACTION_REQUEST';
export const FETCH_TRANSACTION_SUCCESS = 'app/TransactionPage/FETCH_TRANSACTION_SUCCESS';
Expand Down Expand Up @@ -91,8 +91,8 @@ export default function checkoutPageReducer(state = initialState, action = {}) {
case SET_INITAL_VALUES:
return { ...initialState, ...payload };

case CLEAR_ERRORS:
return { ...state, sendMessageError: null, sendReviewError: null };
case RESET_STATE:
return { ...state, sendMessageError: null, sendReviewError: null, messages: [] };

case FETCH_TRANSACTION_REQUEST:
return { ...state, fetchTransactionInProgress: true, fetchTransactionError: null };
Expand Down Expand Up @@ -174,7 +174,7 @@ export const setInitialValues = initialValues => ({
});

// clears tx page message and review sending errors
const clearErrors = () => ({ type: CLEAR_ERRORS });
const resetState = () => ({ type: RESET_STATE });

const fetchTransactionRequest = () => ({ type: FETCH_TRANSACTION_REQUEST });
const fetchTransactionSuccess = response => ({
Expand Down Expand Up @@ -483,7 +483,7 @@ export const loadData = params => dispatch => {
const txId = new UUID(params.id);

// Clear the send error since the message form is emptied as well.
dispatch(clearErrors());
dispatch(resetState());

// Sale / order (i.e. transaction entity in API)
return Promise.all([dispatch(fetchTransaction(txId)), dispatch(fetchMessages(txId, 1))]);
Expand Down