     render: ->
         @$el.addClass 'loading'
 
-        # seek to the end of the file
-        @lines.fetchEndOffset().then (offset) =>
-            @handleEmpty(offset)
-            @tail Math.max(0, offset - @readLength)
+        @taskHistory.fetch().done =>
+            # seek to the end of the file
+            @lines.fetchEndOffset().then (offset) =>
+                @handleEmpty(offset)
+                @tail Math.max(0, offset - @readLength)
 
         @
 

View = require './view'

LogLines = require '../collections/LogLines'

class TailerView extends Backbone.View

        @lines = LogLines.getInstance @options

        @$container = @$('.tail-container')

        @taskHistory = new TaskHistory {}, taskId: @options.taskId

        @lines.on 'sort', =>
            @handleEmpty()
