Created
August 21, 2018 18:04
-
-
Save ericraio/c81414440bc321baab25b7bb8075f8b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom' | |
import { Provider, configureStore } from 'airlytics'; | |
let store; | |
if (process.env.NODE_ENV === "production") { | |
store = configureStore({ | |
dripAccountId: "4552197", | |
}); | |
} else { | |
store = configureStore({ | |
dripAccountId: "4552197", | |
}); | |
} | |
export const onClientEntry = () => { | |
//console.log("We've started!") | |
} | |
export const onInitialClientRender = () => { | |
//console.log("ReactDOM.render has executed") | |
} | |
export const onRouteUpdate = ({ location }) => { | |
//console.log('new pathname', location.pathname) | |
} | |
export const replaceHydrateFunction = () => { | |
return (element, container, callback) => { | |
//console.log("rendering!"); | |
ReactDOM.render(element, container, callback); | |
}; | |
}; | |
export const wrapRootElement = ({ element }) => { | |
const ConnectedRootElement = ( | |
<Provider store={store}> | |
{element} | |
</Provider> | |
) | |
return ConnectedRootElement; | |
} | |
export const shouldUpdateScroll = (args) => { | |
var hadModal, isModal | |
if (args.prevRouterProps && | |
args.prevRouterProps.location && | |
args.prevRouterProps.location.pathname && | |
args.prevRouterProps.location.pathname.match(/\/_/)) { | |
hadModal = true | |
} | |
if (args.pathname.match(/\/_/)) { | |
isModal = true | |
} | |
if (hadModal || isModal) { | |
return false | |
} else { | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment