From 1f1220932c94982fc5d0d292870c713a3b74be45 Mon Sep 17 00:00:00 2001 From: Christopher Pappas Date: Tue, 26 May 2020 18:36:16 -0700 Subject: [PATCH] [Refactor] Dont bundle split all of order app --- src/v2/Apps/Order/routes.tsx | 71 +++++++++++------------------------- 1 file changed, 21 insertions(+), 50 deletions(-) diff --git a/src/v2/Apps/Order/routes.tsx b/src/v2/Apps/Order/routes.tsx index 4d4130f1d30..32b10bf8c5d 100644 --- a/src/v2/Apps/Order/routes.tsx +++ b/src/v2/Apps/Order/routes.tsx @@ -6,17 +6,18 @@ import { Redirect, RedirectException, RouteConfig } from "found" import * as React from "react" import { graphql } from "react-relay" +import RespondRoute from "./Routes/Respond" +import OfferRoute from "./Routes/Offer" +import ShippingRoute from "./Routes/Shipping" +import PaymentRoute from "./Routes/Payment" +import NewPaymentRoute from "./Routes/NewPayment" +import CounterRoute from "./Routes/Counter" +import ReviewRoute from "./Routes/Review" +import AcceptRoute from "./Routes/Accept" +import DeclineRoute from "./Routes/Reject" +import StatusRoute from "./Routes/Status" + const OrderApp = loadable(() => import("./OrderApp")) -const RespondRoute = loadable(() => import("./Routes/Respond")) -const OfferRoute = loadable(() => import("./Routes/Offer")) -const ShippingRoute = loadable(() => import("./Routes/Shipping")) -const PaymentRoute = loadable(() => import("./Routes/Payment")) -const NewPaymentRoute = loadable(() => import("./Routes/NewPayment")) -const CounterRoute = loadable(() => import("./Routes/Counter")) -const ReviewRoute = loadable(() => import("./Routes/Review")) -const AcceptRoute = loadable(() => import("./Routes/Accept")) -const DeclineRoute = loadable(() => import("./Routes/Reject")) -const StatusRoute = loadable(() => import("./Routes/Status")) // FIXME: // * `render` functions requires casting @@ -74,10 +75,7 @@ export const routes: RouteConfig[] = [ children: [ { path: "respond", - getComponent: () => RespondRoute, - prepare: () => { - RespondRoute.preload() - }, + Component: RespondRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_RespondQuery($orderID: ID!) { @@ -92,10 +90,7 @@ export const routes: RouteConfig[] = [ }, { path: "offer", - getComponent: () => OfferRoute, - prepare: () => { - OfferRoute.preload() - }, + Component: OfferRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_OfferQuery($orderID: ID!) { @@ -110,10 +105,7 @@ export const routes: RouteConfig[] = [ }, { path: "shipping", - getComponent: () => ShippingRoute, - prepare: () => { - ShippingRoute.preload() - }, + Component: ShippingRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_ShippingQuery($orderID: ID!) { @@ -128,10 +120,7 @@ export const routes: RouteConfig[] = [ }, { path: "payment", - getComponent: () => PaymentRoute, - prepare: () => { - PaymentRoute.preload() - }, + Component: PaymentRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_PaymentQuery($orderID: ID!) { @@ -149,10 +138,7 @@ export const routes: RouteConfig[] = [ }, { path: "payment/new", - getComponent: () => NewPaymentRoute, - prepare: () => { - NewPaymentRoute.preload() - }, + Component: NewPaymentRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_NewPaymentQuery($orderID: ID!) { @@ -170,10 +156,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/counter", - getComponent: () => CounterRoute, - prepare: () => { - CounterRoute.preload() - }, + Component: CounterRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_CounterQuery($orderID: ID!) { @@ -188,10 +171,7 @@ export const routes: RouteConfig[] = [ }, { path: "review", - getComponent: () => ReviewRoute, - prepare: () => { - ReviewRoute.preload() - }, + Component: ReviewRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_ReviewQuery($orderID: ID!) { @@ -206,10 +186,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/accept", - getComponent: () => AcceptRoute, - prepare: () => { - AcceptRoute.preload() - }, + Component: AcceptRoute, query: graphql` query routes_AcceptQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { @@ -223,10 +200,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/decline", - getComponent: () => DeclineRoute, - prepare: () => { - DeclineRoute.preload() - }, + Component: DeclineRoute, query: graphql` query routes_RejectQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { @@ -237,10 +211,7 @@ export const routes: RouteConfig[] = [ }, { path: "status", - getComponent: () => StatusRoute, - prepare: () => { - StatusRoute.preload() - }, + Component: StatusRoute, query: graphql` query routes_StatusQuery($orderID: ID!) { order: commerceOrder(id: $orderID) {