Skip to content

Fix redundant navigation in permissions tab press handler#11

Merged
digitalnomad91 merged 2 commits intomainfrom
copilot/sub-pr-10
Feb 22, 2026
Merged

Fix redundant navigation in permissions tab press handler#11
digitalnomad91 merged 2 commits intomainfrom
copilot/sub-pr-10

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

When already on the permissions index, the tab press listener was calling e.preventDefault() + router.replace('/(tabs)/permissions') — navigating to the same route unnecessarily, risking flickering.

Changes

  • app/(tabs)/_layout.tsx: Removed isOnPermissionsIndex from the tabPress condition; the handler now only intercepts navigation when on a permissions sub-page
  • Removed the now-unused isOnPermissionsIndex variable

Before:

const isOnPermissionsSubPage = pathname.startsWith('/permissions/') && pathname !== '/permissions';
const isOnPermissionsIndex = pathname === '/permissions' || pathname === '/(tabs)/permissions';

if (isOnPermissionsSubPage || isOnPermissionsIndex) {
    e.preventDefault();
    router.replace('/(tabs)/permissions');
}

After:

const isOnPermissionsSubPage = pathname.startsWith('/permissions/') && pathname !== '/permissions';

if (isOnPermissionsSubPage) {
    e.preventDefault();
    router.replace('/(tabs)/permissions');
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: digitalnomad91 <2067771+digitalnomad91@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on profile screen improvements from PR #10 Fix redundant navigation in permissions tab press handler Feb 22, 2026
Copilot AI requested a review from digitalnomad91 February 22, 2026 08:03
Base automatically changed from feature/profile-screen-and-improvements to main February 22, 2026 08:06
@digitalnomad91 digitalnomad91 marked this pull request as ready for review February 22, 2026 08:07
Copilot AI review requested due to automatic review settings February 22, 2026 08:07
@digitalnomad91 digitalnomad91 merged commit 025ecb5 into main Feb 22, 2026
1 check passed
@digitalnomad91 digitalnomad91 deleted the copilot/sub-pr-10 branch February 22, 2026 08:08
Copy link
Contributor

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 PR fixes a redundant navigation issue in the permissions tab press handler. Previously, when a user was already on the permissions index page and tapped the permissions tab, the handler would unnecessarily navigate to the same route, potentially causing flickering or unwanted behavior.

Changes:

  • Removed the isOnPermissionsIndex check from the tab press handler condition
  • Deleted the unused isOnPermissionsIndex variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants