From ab4fec0f3c6d5a613b309ae6fac41dbb31f1765d Mon Sep 17 00:00:00 2001 From: wekan Date: Mon, 13 May 2019 11:01:50 +0200 Subject: Fixed #2338 -> Slow opening of big boards with too many archived items --- client/components/sidebar/sidebarArchives.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'client/components/sidebar/sidebarArchives.js') diff --git a/client/components/sidebar/sidebarArchives.js b/client/components/sidebar/sidebarArchives.js index b50043fd..546d7e1a 100644 --- a/client/components/sidebar/sidebarArchives.js +++ b/client/components/sidebar/sidebarArchives.js @@ -1,4 +1,26 @@ +const subManager = new SubsManager(); + BlazeComponent.extendComponent({ + onCreated() { + this.isArchiveReady = new ReactiveVar(false); + + // The pattern we use to manually handle data loading is described here: + // https://kadira.io/academy/meteor-routing-guide/content/subscriptions-and-data-management/using-subs-manager + // XXX The boardId should be readed from some sort the component "props", + // unfortunatly, Blaze doesn't have this notion. + this.autorun(() => { + const currentBoardId = Session.get('currentBoard'); + if (!currentBoardId) + return; + const handle = subManager.subscribe('board', currentBoardId, true); + Tracker.nonreactive(() => { + Tracker.autorun(() => { + this.isArchiveReady.set( handle.ready() ); + }); + }); + }); + }, + tabs() { return [ { name: TAPi18n.__('cards'), slug: 'cards' }, -- cgit v1.2.3-1-g7c22