diff options
| author | Shpuld Shpuldson <shp@cock.li> | 2021-01-05 13:58:52 +0200 |
|---|---|---|
| committer | Shpuld Shpuldson <shp@cock.li> | 2021-01-05 13:58:52 +0200 |
| commit | ab2c2c66bfe96571d14cff4b8c69fe0c90d5a3c7 (patch) | |
| tree | d35c6958a49431358e131601ca31f753c804fd99 /src/hocs | |
| parent | 5e96260a4f855e2d93915c1b428a7209a882c8cb (diff) | |
| parent | 3e7d1fbf23b5ca1b382381b49affc481404137da (diff) | |
Merge branch 'develop' into feat/report-notification
Diffstat (limited to 'src/hocs')
| -rw-r--r-- | src/hocs/with_load_more/with_load_more.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/hocs/with_load_more/with_load_more.js b/src/hocs/with_load_more/with_load_more.js index 7df9dbb2..671b2b6f 100644 --- a/src/hocs/with_load_more/with_load_more.js +++ b/src/hocs/with_load_more/with_load_more.js @@ -29,12 +29,8 @@ const withLoadMore = ({ return { loading: false, bottomedOut: false, - error: false - } - }, - computed: { - entries () { - return select(this.$props, this.$store) || [] + error: false, + entries: [] } }, created () { @@ -48,6 +44,11 @@ const withLoadMore = ({ destroy && destroy(this.$props, this.$store) }, methods: { + // Entries is not a computed because computed can't track the dynamic + // selector for changes and won't trigger after fetch. + updateEntries () { + this.entries = select(this.$props, this.$store) || [] + }, fetchEntries () { if (!this.loading) { this.loading = true @@ -61,6 +62,9 @@ const withLoadMore = ({ this.loading = false this.error = true }) + .finally(() => { + this.updateEntries() + }) } }, scrollLoad (e) { |
