@@ -363,7 +363,7 @@ module.exports = baseVw.extend({
363363 self . undoCustomAttributes . secondary_color = self . model . get ( 'page' ) . profile . secondary_color ;
364364 self . undoCustomAttributes . text_color = self . model . get ( 'page' ) . profile . text_color ;
365365 self . setCustomStyles ( ) ;
366- self . setState ( self . state , self . currentItemHash ) ;
366+ self . setState ( self . state , self . currentItemHash , { replaceHistory : true } ) ;
367367
368368 //check if user is blocked
369369 if ( ! self . options . ownPage && isBlocked ) {
@@ -445,13 +445,15 @@ module.exports = baseVw.extend({
445445 }
446446 } ,
447447
448- setState : function ( state , hash ) {
448+ setState : function ( state , hash , options ) {
449449 "use strict" ;
450450 var currentAddress ,
451451 addressState ,
452452 currentHandle = this . model . get ( 'page' ) . profile . handle ,
453453 isItemType = false ;
454454
455+ options = options || { } ;
456+
455457 if ( state === "listing" ) {
456458 //clear old templates
457459 this . $el . find ( '.js-list4' ) . html ( "" ) ;
@@ -463,19 +465,19 @@ module.exports = baseVw.extend({
463465 } else if ( state === "listingNew" ) {
464466 this . tabClick ( this . $el . find ( ".js-storeTab" ) , this . $el . find ( ".js-store" ) ) ;
465467 $ ( '#obContainer' ) . scrollTop ( 352 ) ;
466- this . addTabToHistory ( 'listingNew' ) ;
468+ this . addTabToHistory ( 'listingNew' , options . replaceHistory ) ;
467469 this . sellItem ( ) ;
468470 } else if ( state === "createStore" ) {
469471 this . tabClick ( this . $el . find ( ".js-aboutTab" ) , this . $el . find ( ".js-about" ) ) ;
470- this . addTabToHistory ( 'about' ) ;
472+ this . addTabToHistory ( 'about' , options . replaceHistory ) ;
471473 this . createStore ( ) ;
472474 } else if ( state === "becomeModerator" ) {
473475 this . tabClick ( this . $el . find ( ".js-aboutTab" ) , this . $el . find ( ".js-about" ) ) ;
474- this . addTabToHistory ( 'about' ) ;
476+ this . addTabToHistory ( 'about' , options . replaceHistory ) ;
475477 this . showModeratorModal ( ) ;
476478 } else if ( state === "customize" ) {
477479 this . tabClick ( this . $el . find ( ".js-aboutTab" ) , this . $el . find ( ".js-about" ) ) ;
478- this . addTabToHistory ( 'about' ) ;
480+ this . addTabToHistory ( 'about' , options . replaceHistory ) ;
479481 this . customizePage ( ) ;
480482 } else if ( state == "store" ) {
481483 //if this page is not a vendor, don't go to their store
@@ -485,7 +487,7 @@ module.exports = baseVw.extend({
485487 state = "about" ;
486488 }
487489 this . tabClick ( this . $el . find ( ".js-" + state + "Tab" ) , this . $el . find ( ".js-" + state ) ) ;
488- this . addTabToHistory ( state ) ;
490+ this . addTabToHistory ( state , options . replaceHistory ) ;
489491 } else if ( state ) {
490492 this . tabClick ( this . $el . find ( ".js-" + state + "Tab" ) , this . $el . find ( ".js-" + state ) ) ;
491493 } else {
@@ -949,10 +951,10 @@ module.exports = baseVw.extend({
949951 showContent . removeClass ( 'hide' ) ;
950952 } ,
951953
952- addTabToHistory : function ( state ) {
954+ addTabToHistory : function ( state , replace ) {
953955 "use strict" ;
954956 //add action to history if not an item
955- Backbone . history . navigate ( '#userPage/' + this . model . get ( 'page' ) . profile . guid + "/" + state ) ;
957+ Backbone . history . navigate ( '#userPage/' + this . model . get ( 'page' ) . profile . guid + "/" + state , { replace : true } ) ;
956958 } ,
957959
958960 sellItem : function ( ) {
0 commit comments