Skip to content

fix(tabs): add fallback to select tab if router integration fails #30599

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 1 commit into from
Aug 4, 2025

Conversation

ShaneK
Copy link
Member

@ShaneK ShaneK commented Aug 4, 2025

Issue number: resolves #30552


What is the current behavior?

Something caused a timing shift in v8.6.0 that messed up the timing required for react router to set the active tab ID. Currently, when the router goes to set the tab ID, it's possibly too early and the tab may not exist yet, causing it to go unset.

What is the new behavior?

This PR is a workaround that allows tabs to check when they're rendered if a tab should be selected as a fallback for the router not setting them. I don't think the tabs, in the long run, should be responsible for this, but I think this is a good intermediate step until the upcoming react router upgrade, when we can look into a better solution for react router that may require less timing precision.

This PR also adds regression tests for React to make sure this doesn't happen again without getting noticed.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Current dev build:

8.7.2-dev.11754338216.1a548096

@ShaneK ShaneK requested a review from a team as a code owner August 4, 2025 20:09
@ShaneK ShaneK requested a review from brandyscarney August 4, 2025 20:09
Copy link

vercel bot commented Aug 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2025 8:49pm

@github-actions github-actions bot added package: core @ionic/core package package: react @ionic/react package labels Aug 4, 2025
@brandyscarney brandyscarney changed the title fix(ion-tab): add fallback to select tab if router integration fails fix(tabs): add fallback to select tab if router integration fails Aug 4, 2025
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

LGTM!

@ShaneK ShaneK added this pull request to the merge queue Aug 4, 2025
Merged via the queue into main with commit a2e803a Aug 4, 2025
52 checks passed
@ShaneK ShaneK deleted the FW-6721-clean branch August 4, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package package: react @ionic/react package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: IonTab not selected on dynamic routes (introduced in 8.6.0)
2 participants