Old tab stops sending requests to API React

102 Views Asked by At

I have a problem that is hard to describe. The problem is reproduced in 2 cases.

  1. Old browser tab (not closed from yesterday's session).
  2. After the token is expired, I redirect to the login page, and if I click back in the browser, the problem appears.

What is the problem?

On such a tab, requests are no longer sent, but the content is drawn from the old data. I don't cache data anywhere.

The query logic is simple. For requests i used axios.

const getSomeData = async () => { const res = await axios.get('/url')}

useEffect(() => getSomeData(), [])

On such a tab, useEffect does not run. Reloading the page doesn't help. hard reboot too.

In the network tab, I see my request, but it is not marked as Fetсh / XHR and the very first one is loaded, before the scripts are loaded

sceen all request headers request

Also in this request, it goes to the localhost and not to the domain, and the token is not sent.

In preview i get the following:

preview request

I think that javascript works because the logic of pressing buttons, opening modal windows works, but requests are not sent on such a tab. But due to the fact that requests are not sent, it does not work, I cannot try to process such a tab

I tried to search this error, but I did not find anything that would help my problem. I also failed to process through useEffect.

0

There are 0 best solutions below