Skip to content

Commit

Permalink
Fix #1333 by reverting #1194 (which alse involves #1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Jan 19, 2024
1 parent fc75a5b commit 09e8226
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 30 deletions.
5 changes: 4 additions & 1 deletion WHATSNEW.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## V3.5.1
## V3.5.2
- Issue [#1333](https://github.com/microsoft/fluentui-blazor/issues/1333): FluentSwitch inside FluentTab does not work anymore (revert #1194)

## V3.5.1
- Issue [#1323](https://github.com/microsoft/fluentui-blazor/issues/1323): Rapidly clicking between UI component throws Microsoft.JSInterop.JSException
- Issue [#1319](https://github.com/microsoft/fluentui-blazor/issues/1319): Fix FluentCheckbox issue
- Issue [#1324](https://github.com/microsoft/fluentui-blazor/issues/1324): Fix JustifyContent enum documentation description
Expand Down
5 changes: 4 additions & 1 deletion examples/Demo/Shared/wwwroot/docs/WhatsNew.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## V3.5.1
## V3.5.2
- Issue [#1333](https://github.com/microsoft/fluentui-blazor/issues/1333): FluentSwitch inside FluentTab does not work anymore (revert #1194)

## V3.5.1
- Issue [#1323](https://github.com/microsoft/fluentui-blazor/issues/1323): Rapidly clicking between UI component throws Microsoft.JSInterop.JSException
- Issue [#1319](https://github.com/microsoft/fluentui-blazor/issues/1319): Fix FluentCheckbox issue
- Issue [#1324](https://github.com/microsoft/fluentui-blazor/issues/1324): Fix JustifyContent enum documentation description
Expand Down
40 changes: 12 additions & 28 deletions src/Core/Components/Tabs/FluentTabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public partial class FluentTabs : FluentComponentBase
private DotNetObjectReference<FluentTabs>? _dotNetHelper = null;
private IJSObjectReference _jsModuleOverflow = default!;

private bool _shouldRender = true;

/// <summary />
protected string? ClassValue => new CssBuilder(Class)
.Build();
Expand Down Expand Up @@ -67,20 +65,20 @@ public partial class FluentTabs : FluentComponentBase
public bool ShowClose { get; set; } = false;

/// <summary>
/// Width of the tab items.
/// Gets or sets the width of the tab items.
/// </summary>
[Parameter]
public TabSize? Size { get; set; } = TabSize.Medium;

/// <summary>
/// Width of the tabs component.
/// Gets or sets the width of the tabs component.
/// Needs to be a valid CSS value (e.g. 100px, 50%).
/// </summary>
[Parameter]
public string? Width { get; set; }

/// <summary>
/// Height of the tabs component.
/// Gets or sets the height of the tabs component.
/// Needs to be a valid CSS value (e.g. 100px, 50%).
/// </summary>
[Parameter]
Expand All @@ -101,9 +99,8 @@ public partial class FluentTabs : FluentComponentBase
[Parameter]
public EventCallback<string> ActiveTabIdChanged { get; set; }


/// <summary>
/// Whether or not to show the active indicator
/// Gets or sets a value indicating whether the active indicator is displayed.
/// </summary>
[Parameter]
public bool ShowActiveIndicator { get; set; } = true;
Expand All @@ -115,7 +112,7 @@ public partial class FluentTabs : FluentComponentBase
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// Gets or sets a callback when a tab is changed .
/// Gets or sets a callback when a tab is changed.
/// </summary>
[Parameter]
public EventCallback<FluentTab> OnTabChange { get; set; }
Expand Down Expand Up @@ -155,28 +152,16 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
}

protected override bool ShouldRender()
{
return _shouldRender;
}

private async Task HandleOnTabChanged(TabChangeEventArgs args)
{
if (args is not null)
string? tabId = args?.ActiveId;
if (tabId is not null && _tabs.TryGetValue(tabId, out FluentTab? tab))
{
string? tabId = args.ActiveId;
if (tabId is not null && _tabs.TryGetValue(tabId, out FluentTab? tab))
{
await OnTabChange.InvokeAsync(tab);
ActiveTabId = tabId;
await ActiveTabIdChanged.InvokeAsync(tabId);
}
_shouldRender = true;
}
else
{
_shouldRender = false;
await OnTabChange.InvokeAsync(tab);
ActiveTabId = tabId;
await ActiveTabIdChanged.InvokeAsync(tabId);
}

}

internal int RegisterTab(FluentTab tab)
Expand Down Expand Up @@ -224,7 +209,6 @@ internal async Task OnTabChangeHandlerAsync(TabChangeEventArgs e)
{
await OnTabSelect.InvokeAsync(ActiveTab);
}
_shouldRender = true;
}

/// <summary />
Expand Down Expand Up @@ -278,6 +262,6 @@ await OnTabChangeHandlerAsync(new TabChangeEventArgs()
{
ActiveId = TabId,
});

}
}

0 comments on commit 09e8226

Please sign in to comment.