Skip to content

Commit

Permalink
listen to localStore before setting client.accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
vinu-deriv committed Feb 21, 2025
1 parent 43dbb90 commit 8b47fb2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/javascript/app/base/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ const Page = (() => {

// Watch for changes in the current window
const originalSetItem = LocalStore.setObject;
const originalSet = LocalStore.set;

LocalStore.setObject = function(key, value) {
const oldValue = LocalStore.getObject(key);
originalSetItem.apply(this, [key, value]);
Expand All @@ -129,6 +131,16 @@ const Page = (() => {
}
};

LocalStore.set = function(key, value) {
originalSet.apply(this, [key, value]);
if (key === 'active_loginid') {
const session_loginid = SessionStore.get('active_loginid');
if (session_loginid && session_loginid !== value) {
LocalStore.set('active_loginid', session_loginid);
}
}
};

scrollToTop();
});
};
Expand Down

0 comments on commit 8b47fb2

Please sign in to comment.