barba: Page refreshed after timeout instead of redirected

The problem

When the server takes too long to answer from a fetch, the page gets refreshed instead of redirecting the user to the target page. It seems to be a regression since V2.8.0. I tested with versions 2.6.1 and 2.7.2 and both are working correctly. It’s easy to reproduce by setting a very low timeout option value.

Description

See this screenshot using the version 2.8.0 where the problem occurs image

See this screenshot using the version 2.6.1 without the problem image

Steps to reproduce issue [ Good To Have ]

Broken demo

  1. Go to: https://mamboleoo.be/barba/
  2. Open devtools and simulate 3G slow connection
  3. Click on test url
  4. You stay on the same page instead

Working demo

  1. Go to: https://mamboleoo.be/barba/old.html
  2. Open devtools and simulate 3G slow connection
  3. Click on test url
  4. You are redirected to the target page

Environment

  • Barba version that exhibits the issue: ^2.8.0
  • Browser OS/version used: All

Thanks for having a look at this!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 26 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@thierrymichel Sorry I just got back on the project where I’m using Barba. I’m testing version 2.9.7 and the bug seems to be still there. When using debug:true it doesn’t refresh the page (so the expected behaviour) and I’m getting those console errors. image

Hello @xavierfoucrier,

thank you so much for your fast reply! And thank you for your tips.

The issue is not so much the reload/lack of transition (some users do not even notice), but that the user ends up on the same page he was before. In older versions (1.x) a timeout would cause a full page load but the the user would end up at the target page (team in this case). The current behavior is kind of bad from a UX / progressive enhancement point of view as the user clicks a link and does not end up there (not even with a reload).

Is there a recommended way to force the link to go through if the request times out, even if it is without a transition?

@xavierfoucrier I do not have a reproductible repo that isolates that problem at the moment. I have the issue happening repeatedly on this website in production https://www.bold.ch/ (particularly on mobile). It uses @barba/core@2.9.7. The barba timeout is quite high at the moment so it does not happen often.

I will try to create a repo soon and share it here.

Good catch, its a bug, thanks for pointing this out! 😃

I updated the demo and the issue is still occurring even with prefetchIgnore: true 😕 https://mamboleoo.be/barba/