Skip to content

fix(tabs): touch swipe on tab-items doesn't update the tab value #2396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025

Conversation

capdiem
Copy link
Contributor

@capdiem capdiem commented May 7, 2025

Fixes #2391

@capdiem capdiem requested a review from Copilot May 7, 2025 15:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes issue #2391 by standardizing binding syntax in various tab components and enhancing the internal index update logic in the MWindow component. The key changes are:

  • Improvements in binding syntax across Razor components (DesktopTabs, TabItems, OverflowToMenu, IconAndText, Grow, DynamicTabs, DynamicHeight).
  • An early return in MWindow.UpdateInternalIndex to prevent unnecessary updates.
  • Use of TabItems.Count > 0 in MTabs for clarity and potential performance improvements.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

File Description
src/Masa.Blazor/Components/Window/MWindow.razor.cs Added an early return in UpdateInternalIndex to prevent redundant state updates
src/Masa.Blazor/Components/Tabs/MTabs.razor Updated logical condition from Any() to Count > 0 and introduced a ValueChanged callback in the MWindow component
docs/Masa.Blazor.Docs/Examples/components/tabs/*.razor Revised binding syntax in multiple examples to ensure consistency across documentation
Comments suppressed due to low confidence (2)

src/Masa.Blazor/Components/Window/MWindow.razor.cs:65

  • [nitpick] Consider adding an inline comment clarifying that the early return is used to prevent redundant updates, which improves performance and avoids unnecessary computations.
if (_prevInternalIndex == InternalIndex) {

src/Masa.Blazor/Components/Tabs/MTabs.razor:36

  • Ensure that the ValueChanged callback is handled properly within the MWindow component to support effective two-way binding, aligning with the updated binding syntax.
<MWindow Value="Value" ValueChanged="@ValueChanged">

@capdiem capdiem added this to the 1.9.x milestone May 7, 2025
@Qinyouzeng Qinyouzeng merged commit 355ea6c into main May 8, 2025
1 check passed
@Qinyouzeng Qinyouzeng deleted the bugfix/issue-2391 branch May 8, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] 文档中MTabsItems在移动端滑动后,MTabs值未更新
2 participants