From 6d4d705c51a3d39e4de22a3320cfa61ef63a0066 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 13 Feb 2019 23:25:21 -0500
Subject: Rename some options and add comments to HOCs
---
src/hocs/with_subscription/with_subscription.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'src/hocs/with_subscription')
diff --git a/src/hocs/with_subscription/with_subscription.js b/src/hocs/with_subscription/with_subscription.js
index 21630b40..960c6d71 100644
--- a/src/hocs/with_subscription/with_subscription.js
+++ b/src/hocs/with_subscription/with_subscription.js
@@ -4,8 +4,12 @@ import isEmpty from 'lodash/isEmpty'
import omit from 'lodash/omit'
import './with_subscription.scss'
-const withSubscription = ({ fetch, select, contentPropName = 'content' }) => (WrapperComponent) => {
- const originalProps = WrapperComponent.props || []
+const withSubscription = ({
+ fetch, // function to fetch entries and return a promise
+ select, // function to select data from store
+ childPropName = 'content' // name of the prop to be passed into the wrapped component
+}) => (WrappedComponent) => {
+ const originalProps = WrappedComponent.props || []
const props = reject(originalProps, v => v === 'content')
return Vue.component('withSubscription', {
@@ -13,13 +17,13 @@ const withSubscription = ({ fetch, select, contentPropName = 'content' }) => (Wr
const props = {
props: {
...omit(this.$props, 'refresh'),
- [contentPropName]: this.fetchedData
+ [childPropName]: this.fetchedData
},
on: this.$listeners
}
return (
- {!this.error && !this.loading && }
+ {!this.error && !this.loading && }