Mini Program cache problem

I met an incredible bug: today. I have a tabar, with two corresponding pages under it. After I am authorized to enter the home page, switch to another page, and it will automatically jump back to the home page. I continue to click on a block on the home page to go to its subordinate page, and it immediately jumps back to the home page. The screenshot of the demo is as follows:
first authorization:

clipboard.png

:

clipboard.png

clipboard.png
:

clipboard.png
0.5s~2s:

clipboard.png
fooled me, so I had no choice but to keep looking for the cause. Finally, I found the cause of the problem (on the Mini Program editor): when I cleared the cache, entered the authorization again, and entered the home page, the problem occurred, and when I refreshed (ctrl+s), it switched normally. On the phone, if the phone that has cleaned the cache is opened in the previous step, there will be a problem. If the phone does not clear the cache, it is normal to reopen it.
but the problem factor has been found, but how it is generated or confused, there is no way to solve it. My login authorization page code is also typed according to the code in the manual, plus my own login method, which is mainly to request the background interface, return user information, set the cache, and jump to the home page:

 var userinfo = res.data.data;
 wx.setStorageSync("userinfo", userinfo);
setInterval(function(){
   wx.switchTab({
       url: "../index/index",
   })
},3000);

and when the above problems occur, the page does not report an error. This is really, has there been any brother who has encountered this kind of problem or knows this kind of problem, please give me some advice

May.22,2021

var userinfo = res.data.data;
 wx.setStorageSync('userinfo', userinfo);
setInterval(function(){
   wx.switchTab({
       url: '../index/index',
   })
},3000);
The setInterval in

is executed every 3000 milliseconds. Do you want to use setTimeout


after Synchronize saves user information, why set a timer to jump? Is it possible to do this:

var userinfo = res.data.data;
wx.setStorageSync('userinfo', userinfo);
wx.switchTab({
  url: '../index/index',
})
Menu