amida-tech/DRE

timeline gets called multiple times per page load

Closed this issue · 3 comments

On a full page reload timeline gets called at least 10 times

renderPlot() is called in the following places within timeline.js:
$window.onload (line 280)
$timeout (line 286)
$window.onresize (line 293)

Watch points on all the following:

  • inactiveFlag
  • entryType
  • pageLoaded
  • entryListFiltered

I'll consoleLog these call and see which ones are getting hit.

From the console output, it looks like this is the order the events happen in:

  1. inactiveFlag
  2. entryType
  3. pageLoaded
  4. entryListFiltered
  5. timeout/DOM load
  6. onload

The first four are from watch points. So maybe we need a way for the watch points to not trigger the first time. pageLoaded may be redundant at this point, same with on-load.

Adding the following line at the top of watch functions:
if (newValue !== oldValue)
Skips them on initialization.