File tree Expand file tree Collapse file tree
apps/cowswap-frontend/public Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,8 +28,20 @@ if (window.location.pathname !== '/') {
2828
2929; ( async function ( ) {
3030 const WIPE_KEY = 'emergencyWipe:v1'
31+ const RETURNING_USER_KEY = 'tokens:lastUpdateTimeAtom:v6'
32+ const hasVisitedBefore = localStorage . getItem ( RETURNING_USER_KEY ) !== null
3133
32- if ( localStorage . getItem ( WIPE_KEY ) ) return
34+ if ( localStorage . getItem ( WIPE_KEY ) ) {
35+ console . log ( '[COW] Storage already clean' )
36+ return
37+ }
38+
39+ if ( ! hasVisitedBefore ) {
40+ console . log ( '[COW] New user, skipping storage wipe' )
41+ localStorage . setItem ( WIPE_KEY , '1' )
42+ return
43+ }
44+ console . log ( '[COW] Performing emergency wipe' )
3345
3446 // 1. localStorage (re-set wipe flag after)
3547 localStorage . clear ( )
@@ -123,6 +135,8 @@ if (window.location.pathname !== '/') {
123135 )
124136 }
125137 } catch { }
138+
139+ window . location . reload ( )
126140} ) ( )
127141
128142/**
You can’t perform that action at this time.
0 commit comments