🐛 Bug Report
When you show FluentTabs conditionally then ActiveTabId will be set to an empty string when the component is being removed and then re-rendered on the DOM.
💻 Repro or Code Sample
@page "/Debug/Test"
@layout FluentUI.Demo.Client.Layout.EmptyLayout
<FluentButton OnClick="LoadAsync">Load</FluentButton>
@if (isLoading)
{
<FluentSpinner />
}
else
{
<FluentTabs @bind-ActiveTabId="activeTabId">
<FluentTab Header="General" Id="tab-general">
Some general information
</FluentTab>
<FluentTab Header="Files" Id="tab-files">
Some cool files here
</FluentTab>
<FluentTab Header="Recap" Id="tab-recap">
Here is a recap
</FluentTab>
</FluentTabs>
}
<p>ActiveTabId: @activeTabId</p>
@code {
private string activeTabId = "tab-files";
private bool isLoading;
private async Task LoadAsync()
{
isLoading = true;
await Task.Delay(2500);
isLoading = false;
}
}
- Paste into Test.razor
- Run project
- Notice that tab 2 is opened by default
- Click on load
- Notice that ActiveTabId will be set to
string.Empty
- Tab 1 is being displayed
🤔 Expected Behavior
I expect the component to stay at tab 2 even after the re-render.
😯 Current Behavior
The component will re-render and fallback to tab 1 as active tab.
🔦 Context
I'm using this technique in a save method which then reloads the object from the database which triggers a re-render of the page for a loading animation. Afterwards the UI will be rendered again and it falls back to the first tab. In v4 this was possible as shown in the example code.
🌍 Your Environment
- OS & Device: Windows 11 64 Bit
- Browser latest Firefox, Chrome and Edge
- latest dev-v5 branch
🐛 Bug Report
When you show
FluentTabsconditionally thenActiveTabIdwill be set to an empty string when the component is being removed and then re-rendered on the DOM.💻 Repro or Code Sample
string.Empty🤔 Expected Behavior
I expect the component to stay at tab 2 even after the re-render.
😯 Current Behavior
The component will re-render and fallback to tab 1 as active tab.
🔦 Context
I'm using this technique in a save method which then reloads the object from the database which triggers a re-render of the page for a loading animation. Afterwards the UI will be rendered again and it falls back to the first tab. In v4 this was possible as shown in the example code.
🌍 Your Environment