diff options
| author | Shpuld Shpludson <shp@cock.li> | 2019-02-28 17:53:40 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2019-02-28 17:53:40 +0000 |
| commit | 88c7c8b1140aaa719e9c9314a8ce9fd04ef3baf1 (patch) | |
| tree | fd18256839bf48bc3c4c0111aa62b8534930e7e8 /src/hocs/with_load_more | |
| parent | dc01f90dde55e2babf58878177308c11aa965006 (diff) | |
| parent | 36460fd3849816af921efdc0b36a6f31f93976ea (diff) | |
Merge branch '398-rewrite-follow-list' into 'develop'
Split UserCard into FollowCard/FollowRequestCard and Rewrite FollowList using HOCs
Closes #398
See merge request pleroma/pleroma-fe!616
Diffstat (limited to 'src/hocs/with_load_more')
| -rw-r--r-- | src/hocs/with_load_more/with_load_more.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/hocs/with_load_more/with_load_more.js b/src/hocs/with_load_more/with_load_more.js index e862a39b..74979b87 100644 --- a/src/hocs/with_load_more/with_load_more.js +++ b/src/hocs/with_load_more/with_load_more.js @@ -1,15 +1,17 @@ import Vue from 'vue' -import filter from 'lodash/filter' import isEmpty from 'lodash/isEmpty' +import { getComponentProps } from '../../services/component_utils/component_utils' import './with_load_more.scss' const withLoadMore = ({ fetch, // function to fetch entries and return a promise select, // function to select data from store - childPropName = 'entries' // name of the prop to be passed into the wrapped component + destroy, // function called at "destroyed" lifecycle + childPropName = 'entries', // name of the prop to be passed into the wrapped component + additionalPropNames = [] // additional prop name list of the wrapper component }) => (WrappedComponent) => { - const originalProps = WrappedComponent.props || [] - const props = filter(originalProps, v => v !== 'entries') + const originalProps = Object.keys(getComponentProps(WrappedComponent)) + const props = originalProps.filter(v => v !== childPropName).concat(additionalPropNames) return Vue.component('withLoadMore', { render (createElement) { @@ -56,6 +58,7 @@ const withLoadMore = ({ }, destroyed () { window.removeEventListener('scroll', this.scrollLoad) + destroy && destroy(this.$props, this.$store) }, methods: { fetchEntries () { |
