Skip to content

Infinite loop when navigating away from a tab that is being loaded #8699

Closed

Description

@timklge-saxms

Description

I have a tabsheet with a couple of tabs on a page. Each tab takes a while to load (e. g. 2000ms delay in onAttach). When the user opens a tab A and then quickly navigates to another tab B before A has been loaded, the UI will enter an infinite loop of switching between Tab A and B that the user can not escape from.

mre.mp4

Expected outcome

Tab B remains open

Minimal reproducible example

var tabSheet = new TabSheet();
add(tabSheet);

for(int i = 0; i < 5; i++){
    var tab = new VerticalLayout();

    tab.add(new Text("Lorem ipsum dolor sit amet"));
    tab.addAttachListener(e -> {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            throw new RuntimeException(ex);
        }
    });

    tabSheet.add("Tab " + (i + 1), tab);
}

Steps to reproduce

  1. Add the snippet above to a page
  2. Open the page in a browser
  3. Open "Tab 3", then switch back to "Tab 1" before "Tab 3" has been loaded (1000 ms elapsed)

Environment

Vaadin version(s): 25.0.5
OS: Windows 11

Browsers

Firefox

Activity

  1. self-assigned this
    on Feb 16, 2026
  2. vursen commented on Feb 16, 2026

    @vursen
    Contributor

    It's a regression from #3846

  3. vursen commented on Feb 17, 2026

    @vursen
    Contributor

    I'm no longer sure that #3846 is the actual cause of this regression since the infinite loop issue isn't reproducible in versions before 25.0. There must have been some other change that caused it. But either way, the fix works, so let's keep it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions