mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
Reserve use* function naming pattern for React Hooks
Eslint-plugin rules of hooks assumed that useInitialValues was actually a wrongly called hook
This commit is contained in:
parent
7161853006
commit
e2159de9f3
4 changed files with 13 additions and 13 deletions
|
|
@ -90,7 +90,7 @@ export class ListingPageComponent extends Component {
|
|||
}
|
||||
|
||||
handleSubmit(values) {
|
||||
const { history, getListing, params, useInitialValues } = this.props;
|
||||
const { history, getListing, params, callSetInitialValues } = this.props;
|
||||
const listingId = new UUID(params.id);
|
||||
const listing = getListing(listingId);
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ export class ListingPageComponent extends Component {
|
|||
const routes = routeConfiguration();
|
||||
// Customize checkout page state with current listing and selected bookingDates
|
||||
const { setInitialValues } = findRouteByRouteName('CheckoutPage', routes);
|
||||
useInitialValues(setInitialValues, initialValues);
|
||||
callSetInitialValues(setInitialValues, initialValues);
|
||||
|
||||
// Redirect to CheckoutPage
|
||||
history.push(
|
||||
|
|
@ -122,14 +122,14 @@ export class ListingPageComponent extends Component {
|
|||
}
|
||||
|
||||
onContactUser() {
|
||||
const { currentUser, history, useInitialValues, params, location } = this.props;
|
||||
const { currentUser, history, callSetInitialValues, params, location } = this.props;
|
||||
|
||||
if (!currentUser) {
|
||||
const state = { from: `${location.pathname}${location.search}${location.hash}` };
|
||||
|
||||
// We need to log in before showing the modal, but first we need to ensure
|
||||
// that modal does open when user is redirected back to this listingpage
|
||||
useInitialValues(setInitialValues, { enquiryModalOpenForListingId: params.id });
|
||||
callSetInitialValues(setInitialValues, { enquiryModalOpenForListingId: params.id });
|
||||
|
||||
// signup and return back to listingPage.
|
||||
history.push(createResourceLocatorString('SignupPage', routeConfiguration(), {}, {}), state);
|
||||
|
|
@ -504,7 +504,7 @@ ListingPageComponent.propTypes = {
|
|||
scrollingDisabled: bool.isRequired,
|
||||
enquiryModalOpenForListingId: string,
|
||||
showListingError: propTypes.error,
|
||||
useInitialValues: func.isRequired,
|
||||
callSetInitialValues: func.isRequired,
|
||||
reviews: arrayOf(propTypes.review),
|
||||
fetchReviewsError: propTypes.error,
|
||||
timeSlots: arrayOf(propTypes.timeSlot),
|
||||
|
|
@ -563,7 +563,7 @@ const mapStateToProps = state => {
|
|||
const mapDispatchToProps = dispatch => ({
|
||||
onManageDisableScrolling: (componentId, disableScrolling) =>
|
||||
dispatch(manageDisableScrolling(componentId, disableScrolling)),
|
||||
useInitialValues: (setInitialValues, values) => dispatch(setInitialValues(values)),
|
||||
callSetInitialValues: (setInitialValues, values) => dispatch(setInitialValues(values)),
|
||||
onSendEnquiry: (listingId, message) => dispatch(sendEnquiry(listingId, message)),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ describe('ListingPage', () => {
|
|||
onLoadListing: noop,
|
||||
onManageDisableScrolling: noop,
|
||||
scrollingDisabled: false,
|
||||
useInitialValues: noop,
|
||||
callSetInitialValues: noop,
|
||||
sendVerificationEmailInProgress: false,
|
||||
onResendVerificationEmail: noop,
|
||||
sendEnquiryInProgress: false,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export const TransactionPageComponent = props => {
|
|||
onDeclineSale,
|
||||
timeSlots,
|
||||
fetchTimeSlotsError,
|
||||
useInitialValues,
|
||||
callSetInitialValues,
|
||||
} = props;
|
||||
|
||||
const currentTransaction = ensureTransaction(transaction);
|
||||
|
|
@ -93,7 +93,7 @@ export const TransactionPageComponent = props => {
|
|||
const routes = routeConfiguration();
|
||||
// Customize checkout page state with current listing and selected bookingDates
|
||||
const { setInitialValues } = findRouteByRouteName('CheckoutPage', routes);
|
||||
useInitialValues(setInitialValues, initialValues);
|
||||
callSetInitialValues(setInitialValues, initialValues);
|
||||
|
||||
// Redirect to CheckoutPage
|
||||
history.push(
|
||||
|
|
@ -264,7 +264,7 @@ TransactionPageComponent.propTypes = {
|
|||
onSendMessage: func.isRequired,
|
||||
timeSlots: arrayOf(propTypes.timeSlot),
|
||||
fetchTimeSlotsError: propTypes.error,
|
||||
useInitialValues: func.isRequired,
|
||||
callSetInitialValues: func.isRequired,
|
||||
|
||||
// from withRouter
|
||||
history: shape({
|
||||
|
|
@ -338,7 +338,7 @@ const mapDispatchToProps = dispatch => {
|
|||
dispatch(manageDisableScrolling(componentId, disableScrolling)),
|
||||
onSendReview: (role, tx, reviewRating, reviewContent) =>
|
||||
dispatch(sendReview(role, tx, reviewRating, reviewContent)),
|
||||
useInitialValues: (setInitialValues, values) => dispatch(setInitialValues(values)),
|
||||
callSetInitialValues: (setInitialValues, values) => dispatch(setInitialValues(values)),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ describe('TransactionPage - Sale', () => {
|
|||
onAcceptSale: noop,
|
||||
onDeclineSale: noop,
|
||||
scrollingDisabled: false,
|
||||
useInitialValues: noop,
|
||||
callSetInitialValues: noop,
|
||||
transaction,
|
||||
totalMessages: 0,
|
||||
totalMessagePages: 0,
|
||||
|
|
@ -101,7 +101,7 @@ describe('TransactionPage - Order', () => {
|
|||
fetchMessagesInProgress: false,
|
||||
sendMessageInProgress: false,
|
||||
scrollingDisabled: false,
|
||||
useInitialValues: noop,
|
||||
callSetInitialValues: noop,
|
||||
transaction,
|
||||
onShowMoreMessages: noop,
|
||||
onSendMessage: noop,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue