Skip to content

Commit

Permalink
Skip auth-sync reload if already authenticating
Browse files Browse the repository at this point in the history
## Issue
Closes #3009: "Tabs reloading itself when multiple are opened simultaneously"
  • Loading branch information
infinite-persistence committed Oct 26, 2023
1 parent a22b00e commit f9e9582
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/redux/middleware/auth-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Store = { dispatch: Dispatch, getState: GetState };
export const populateAuthTokenHeader = (store: Store) => {
return (next: any) => (action: any) => {
// @if TARGET='web'
const { dispatch } = store;
const { dispatch, getState } = store;

switch (action.type) {
case ACTIONS.USER_FETCH_SUCCESS:
Expand All @@ -28,8 +28,9 @@ export const populateAuthTokenHeader = (store: Store) => {
const isVerifyPage = location.href.includes(PAGES.AUTH_VERIFY) && !location.href.includes(PAGES.REWARDS_VERIFY);
const isNewAccount = LocalStorage.getItem(LS.IS_NEW_ACCOUNT) === 'true';
const xAuth = (Lbry.getApiRequestHeaders() || {})[X_LBRY_AUTH_TOKEN] || '';
const state = getState();

if (!xAuth) {
if (!xAuth && !state.user.authenticationIsPending) {
if (isVerifyPage) {
if (isNewAccount) {
LocalStorage.removeItem(LS.IS_NEW_ACCOUNT);
Expand Down

0 comments on commit f9e9582

Please sign in to comment.