Skip to content
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

[router] fix relative navigation on hoisted routes #27778

Merged
merged 3 commits into from Mar 26, 2024

Conversation

marklawlor
Copy link
Contributor

Why

Fix #27753

How

This isIndexPath function was not taking in account hoisted index routes that may not have the param structure

Take the following structure.

_layout // Stack
parent/
└── child/
    ├── index // name: parent/child/index
    └── page  // name: parent/child/page 

Because there are no route params or nested _layout, all routes are hoisted to the root _layout. The existing logic for only checking for route.params is insufficient as it will not exist. Additionally we cannot check for name: 'index' as hoisted routes have complex names.

Test Plan

I think our existing tests are fine, just added one for this scenario

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Mar 20, 2024
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Mar 20, 2024
Copy link
Contributor

@EvanBacon EvanBacon left a comment

Choose a reason for hiding this comment

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

nice work

@marklawlor marklawlor merged commit 5fc443e into main Mar 26, 2024
9 checks passed
@marklawlor marklawlor deleted the marklawlor/router/27753 branch March 26, 2024 05:11
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint compatible bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relative navigation is not working
4 participants