From 62d7166b39a822cb607bac49bdd893d2801e07e8 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 25 Feb 2018 11:20:40 -0800 Subject: [PATCH] code cleanup --- .../PseudoVirtualListLazyItem.html | 16 ++++------- routes/_components/timeline/Timeline.html | 4 +++ .../virtualList/VirtualListLazyItem.html | 28 ++++++++----------- routes/_utils/scheduleIdleTask.js | 3 ++ 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualListLazyItem.html b/routes/_components/pseudoVirtualList/PseudoVirtualListLazyItem.html index 7b6a6ac..ede3b60 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualListLazyItem.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualListLazyItem.html @@ -1,4 +1,5 @@ -{{#if props}} +{{#await asyncProps}} +{{then props}} -{{/if}} +{{/await}} \ No newline at end of file diff --git a/routes/_components/timeline/Timeline.html b/routes/_components/timeline/Timeline.html index fb82b85..8837951 100644 --- a/routes/_components/timeline/Timeline.html +++ b/routes/_components/timeline/Timeline.html @@ -187,6 +187,10 @@ let instanceName = this.store.get('currentInstance') let timelineName = this.get('timeline') let handleItemIdsToAdd = () => { + let itemIdsToAdd = this.get('itemIdsToAdd') + if (!itemIdsToAdd || !itemIdsToAdd.length) { + return + } mark('handleItemIdsToAdd') let scrollTop = this.get('scrollTop') let shouldShowHeader = this.store.get('shouldShowHeader') diff --git a/routes/_components/virtualList/VirtualListLazyItem.html b/routes/_components/virtualList/VirtualListLazyItem.html index b01231a..7f44fde 100644 --- a/routes/_components/virtualList/VirtualListLazyItem.html +++ b/routes/_components/virtualList/VirtualListLazyItem.html @@ -1,24 +1,20 @@ -{{#if props}} - -{{/if}} +{{#await asyncProps}} +{{then props}} + +{{/await}} \ No newline at end of file diff --git a/routes/_utils/scheduleIdleTask.js b/routes/_utils/scheduleIdleTask.js index 4adbdb0..578018f 100644 --- a/routes/_utils/scheduleIdleTask.js +++ b/routes/_utils/scheduleIdleTask.js @@ -3,11 +3,13 @@ // for a good breakdown of the concepts behind this. import Queue from 'tiny-queue' +import { mark, stop } from './marks' const taskQueue = new Queue() let runningRequestIdleCallback = false function runTasks (deadline) { + mark('scheduleIdleTask:runTasks()') while (taskQueue.length && deadline.timeRemaining() > 0) { taskQueue.shift()() } @@ -16,6 +18,7 @@ function runTasks (deadline) { } else { runningRequestIdleCallback = false } + stop('scheduleIdleTask:runTasks()') } export function scheduleIdleTask (task) {