Kaynağa Gözat

Fix infinite scrolling for activities

This fixes the error:

Uncaught TypeError: activitiesComponent.loadNextPage is not a function
    at constructor.reachNextPeak (sidebar.js:63)
    at constructor.BlazeComponent.callFirstWith (peerlibrary_blaze-components.js?hash=4049f7e3116e3d9e865392b9546e70dc479b9add:660)
    at constructor.scroll (infiniteScrolling.js:28)
    at peerlibrary_blaze-components.js?hash=4049f7e3116e3d9e865392b9546e70dc479b9add:469
    at Object.Blaze._withCurrentView (view.js:533)
    at peerlibrary_blaze-components.js?hash=4049f7e3116e3d9e865392b9546e70dc479b9add:468
    at Template._withTemplateInstanceFunc (template.js:490)
    at Blaze.View.eventMap.<computed> (peerlibrary_blaze-components.js?hash=4049f7e3116e3d9e865392b9546e70dc479b9add:467)
    at view.js:879
    at Object.Blaze._withCurrentView (view.js:533)
Marc Hartmayer 5 yıl önce
ebeveyn
işleme
06cacd7a5a
1 değiştirilmiş dosya ile 3 ekleme ve 4 silme
  1. 3 4
      client/components/activities/activities.js

+ 3 - 4
client/components/activities/activities.js

@@ -7,7 +7,7 @@ BlazeComponent.extendComponent({
     // XXX Should we use ReactiveNumber?
     this.page = new ReactiveVar(1);
     this.loadNextPageLocked = false;
-    const sidebar = this.parentComponent(); // XXX for some reason not working
+    const sidebar = Sidebar;
     sidebar.callFirstWith(null, 'resetNextPeak');
     this.autorun(() => {
       let mode = this.data().mode;
@@ -43,16 +43,15 @@ BlazeComponent.extendComponent({
       });
     });
   },
-}).register('activities');
-
-BlazeComponent.extendComponent({
   loadNextPage() {
     if (this.loadNextPageLocked === false) {
       this.page.set(this.page.get() + 1);
       this.loadNextPageLocked = true;
     }
   },
+}).register('activities');
 
+BlazeComponent.extendComponent({
   checkItem() {
     const checkItemId = this.currentData().activity.checklistItemId;
     const checkItem = ChecklistItems.findOne({ _id: checkItemId });