RadzenTabs re-renders when clicking inside an empty space

Hello,

I am using RadzenTabs in my Blazor project. I noticed that when I click inside the tabs (even on empty space), it triggers a re-render and executes the foreach loop again.

Expected Behavior: The RadzenTabs should only update when the selected tab changes, not on every click.

Current Behavior: Clicking anywhere inside RadzenTabsItem causes a full re-render.

Minimal Code to Reproduce :

<RadzenColumn Size="10" Class="box">

                <RadzenTabs Change="ChangeTabs" @bind-SelectedIndex="tabsSelectedIndex">

                    <Tabs>

                        @foreach (var tab in Tabs)

                        {

                            <RadzenTabsItem @ref="tabItem" Text="@tab.title" @key="tab.id">

                                <childComponent tabValues ="@tab.valueList" />

                            </RadzenTabsItem>

                        }

                    </Tabs>

                </RadzenTabs>

            </RadzenColumn>

This is how Blazor works - it’s caused by the code block expression where your tabs are created.

I don't think that's correct. It should not be re-rendering every time you simply click on the page. This doesn't happen with other components.

This is causing a problem for me as well.

For example, with the code below, any time you click anything inside TestComponent it will repeatedly re-render TestComponent, causing its OnParametersSet and OnParametersSetAsync to be called repeatedly. The repeated calls also happen when the component is first rendered.

<RadzenTabs>
    <Tabs>
        <RadzenTabsItem Text="Test">
            <TestComponent TestParam="SomeObject" />
        </RadzenTabsItem>
    </Tabs>
</RadzenTabs>

If TestCompoent is not inside RadzenTabs, this won't happen. OnParametersSet and OnParametersSetAsync are only called once. Even if it's in another Radzen component, like RadzenCard, it won't happen.

Note that this only happens when TestParam is an object, not when it's a simple value type.

Feel free to submit pull request with a fix if you believe this can be improved.