Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / observable-utils / deps / oneServerSideRender.js
Size: Mime:
import { withJob } from 'modules/SSR/react-jobs'
import { isUniqueRouteChange } from 'modules/router'


/**
 * --------------------------------------------------------------------------
 * @NOTE
 * these we can do before ever rendering the class
 * which is faster, since this decorator is run at definition/execution time
 * before "runtime"
 * --------------------------------------------------------------------------
 */
function oneServerSideRender(functionToCallApis: Function) {
  return withJob({
    work: functionToCallApis,
    shouldWorkAgain: isUniqueRouteChange,
  })
}

export { oneServerSideRender, isUniqueRouteChange }
export default oneServerSideRender

// --------------------------------------------------------------------------
// POC
// --------------------------------------------------------------------------
//
// let oneServerSideRender = (
//   onRequest,
//   shouldWorkAgain = isUniqueRouteChange,
//   Target
// ) => {
//   const workRequest = props => {
//     return onRequest(oneRouter.entries(), props)
//     // const { query, path } = onRequest(oneRouter.entries())
//     // return request(query, path)
//   }
//   const connectWithJob = withJob({
//     work: workRequest,
//     shouldWorkAgain,
//   })
//   console.log('In SSR', workRequest)
//   return connectWithJob(Target)
// }
// oneServerSideRender = curry(3, oneServerSideRender)
// ===
// const addServerSideRendering = withJob({
//   work: functionToCallApis,
//   shouldWorkAgain: isUniqueRouteChange,
// })
// ===
// componentWillMountMethod() {
//   const { store, omniStore, jobResult } = tapProps(this.props, false)
//   return dataToStoreHandler(store, jobResult)
// }
// ===
// function componentWillReceivePropsMethod(nextProps) {
//   if (nextProps.jobResult.identifier !== this.props.jobResult.identifier) {
//     const store = this.props.store || omniContainer.store
//     return dataToStoreHandler(store, nextProps.jobResult)
//   }
//   return false
// }