Unified · Split
| @@ -99,14 +99,12 @@ class app.views.Content extends app.View · 98 unmodified lines | ||
| 99 | 99 | return |
| 100 | 100 | |
| 101 | 101 | scrollToTarget: -> |
| 102 | − return if @isLoading() | |
| 103 | 102 | if @routeCtx.hash and el = @findTargetByHash @routeCtx.hash |
| 104 | 103 | $.scrollToWithImageLock el, @scrollEl, 'top', |
| 105 | 104 | margin: if @scrollEl is @el then 0 else $.offset(@el).top |
| 106 | 105 | $.highlight el, className: '_highlight' |
| 107 | 106 | else |
| 108 | 107 | @scrollTo @scrollMap[@routeCtx.state.id] |
| 109 | − clearTimeout @scrollTimeout | |
| 110 | 108 | return |
| 111 | 109 | |
| 112 | 110 | onReady: => |
| @@ -120,21 +118,28 @@ class app.views.Content extends app.View · 7 unmodified lines | ||
| 120 | 118 | |
| 121 | 119 | onEntryLoading: => |
| 122 | 120 | @showLoading() |
| 121 | + if @scrollToTargetTimeout | |
| 122 | + clearTimeout @scrollToTargetTimeout | |
| 123 | + @scrollToTargetTimeout = null | |
| 123 | 124 | return |
| 124 | 125 | |
| 125 | 126 | onEntryLoaded: => |
| 126 | 127 | @hideLoading() |
| 128 | + if @scrollToTargetTimeout | |
| 129 | + clearTimeout @scrollToTargetTimeout | |
| 130 | + @scrollToTargetTimeout = null | |
| 127 | 131 | @scrollToTarget() |
| 128 | 132 | return |
| 129 | 133 | |
| 130 | 134 | beforeRoute: (context) => |
| 131 | 135 | @cacheScrollPosition() |
| 132 | 136 | @routeCtx = context |
| 133 | − @scrollTimeout = @delay @scrollToTarget | |
| 137 | + @scrollToTargetTimeout = @delay @scrollToTarget | |
| 134 | 138 | return |
| 135 | 139 | |
| 136 | 140 | cacheScrollPosition: -> |
| 137 | 141 | return if not @routeCtx or @routeCtx.hash |
| 142 | + return if @routeCtx.path is '/' | |
| 138 | 143 | |
| 139 | 144 | unless @scrollMap[@routeCtx.state.id]? |
| 140 | 145 | @scrollStack.push @routeCtx.state.id |