This repository was archived by the owner on May 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +19
-22
lines changed
Expand file tree Collapse file tree 4 files changed +19
-22
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,12 @@ module.exports = Backbone.Router.extend({
7474 var cached ;
7575
7676 for ( var key in this . viewCache ) {
77- cached = this . viewCache [ key ] ;
78- if ( Date . now ( ) - cached . cachedAt >= cached . view . cacheExpires ) {
79- delete this . viewCache [ key ] ;
77+ if ( this . viewCache . hasOwnProperty ( key ) ) {
78+ cached = this . viewCache [ key ] ;
79+
80+ if ( Date . now ( ) - cached . cachedAt >= cached . view . cacheExpires ) {
81+ delete this . viewCache [ key ] ;
82+ }
8083 }
8184 }
8285 } , this . cleanCacheInterval ) ;
@@ -227,13 +230,15 @@ module.exports = Backbone.Router.extend({
227230 // cachedAt is updated and the user has up until the view's 'cacheExpires' amount of
228231 // time to come back to it in it's current state.
229232 for ( var key in this . viewCache ) {
230- let cached = this . viewCache [ key ] ;
231-
232- if (
233- cached . view === this . view &&
234- ( Date . now ( ) - cached . cachedAt < cached . view . cacheExpires )
235- ) {
236- cached . cachedAt = Date . now ( ) ;
233+ if ( this . viewCache . hasOwnProperty ( key ) ) {
234+ let cached = this . viewCache [ key ] ;
235+
236+ if (
237+ cached . view === this . view &&
238+ ( Date . now ( ) - cached . cachedAt < cached . view . cacheExpires )
239+ ) {
240+ cached . cachedAt = Date . now ( ) ;
241+ }
237242 }
238243 }
239244
Original file line number Diff line number Diff line change @@ -85,15 +85,12 @@ module.exports = pageVw.extend({
8585 if ( e . view !== this ) return ;
8686 state = state || this . state ;
8787
88- if ( this . cachedScrollPositions [ state ] )
88+ if ( this . cachedScrollPositions [ state ] ) {
8989 this . obContainer [ 0 ] . scrollTop = this . cachedScrollPositions [ state ] ;
90- this . setState ( state ) ;
91-
92- if ( ! searchTerm && this . searchItemsText ) {
93- this . searchItemsClear ( state ) ;
94- if ( state === 'products' ) this . obContainer [ 0 ] . scrollTop = 0 ;
9590 }
9691
92+ this . setState ( state ) ;
93+
9794 if ( searchTerm && searchTerm !== this . searchItemsText ) {
9895 this . searchItems ( searchTerm ) ;
9996 this . obContainer [ 0 ] . scrollTop = 0 ;
@@ -192,7 +189,6 @@ module.exports = pageVw.extend({
192189
193190 render : function ( ) {
194191 var self = this ;
195- $ ( '#content' ) . html ( this . $el ) ;
196192
197193 loadTemplate ( './js/templates/backToTop.html' , function ( backToTopTmpl ) {
198194 loadTemplate ( './js/templates/home.html' , function ( loadedTemplate ) {
@@ -520,7 +516,7 @@ module.exports = pageVw.extend({
520516 }
521517 } ,
522518
523- onSearchItemsClear : function ( e ) {
519+ onSearchItemsClear : function ( ) {
524520 this . searchItemsClear ( ) ;
525521 } ,
526522
Original file line number Diff line number Diff line change 11'use strict' ;
22
33var __ = require ( 'underscore' ) ,
4- Backbone = require ( 'backbone' ) ,
54 baseVw = require ( './baseVw' ) ,
65 itemsShortCollection = require ( '../collections/itemsShortCl' ) ,
76 itemShortView = require ( './itemShortVw' ) ,
Original file line number Diff line number Diff line change @@ -368,9 +368,6 @@ UserPageVw = pageVw.extend({
368368
369369 this . model . set ( 'isBlocked' , isBlocked ) ; //add blocked status to model
370370
371- //make sure container is cleared
372- $ ( '#content' ) . html ( this . $el ) ;
373-
374371 loadTemplate ( './js/templates/backToTop.html' , function ( backToTopTmpl ) {
375372 loadTemplate ( './js/templates/userPage.html' , function ( loadedTemplate ) {
376373 self . setCustomStyles ( ) ;
You can’t perform that action at this time.
0 commit comments