Skip to content

Use PathIdentifiable for navigation identity checks#237

Closed
alpkeser wants to merge 1 commit into
zoe/error0fix+logging-retryablefrom
alp/non-visitable-comparison
Closed

Use PathIdentifiable for navigation identity checks#237
alpkeser wants to merge 1 commit into
zoe/error0fix+logging-retryablefrom
alp/non-visitable-comparison

Conversation

@alpkeser

@alpkeser alpkeser commented May 4, 2026

Copy link
Copy Markdown

visitingSamePage and visitingPreviousPage fall back to view-controller type equality when the candidate isn't a Visitable / VisitableViewController. Two instances of the same custom class with different URLs are then indistinguishable, causing an incorrect pop or replace instead of a push.

Adds a PathIdentifiable protocol exposing initialVisitableURL. Visitable inherits from it (existing conformers are unchanged), and both checks now prefer URL identity over type identity. Custom native view controllers can opt in by conforming to PathIdentifiable.

visitingSamePage and visitingPreviousPage fell back to view-controller type equality for non-Visitable / non-VisitableViewController candidates, so two instances of the same custom class with different URLs were indistinguishable — causing an incorrect pop or replace instead of a push.
@alpkeser
alpkeser requested a review from svara May 4, 2026 08:47
@svara svara self-assigned this May 4, 2026

@svara svara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is ok as a temporary fix(not merging to main).
Long term, we should aim to have something similar to Android where the library takes care of assigning the destination URL automatically.

@svara

svara commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Closing in favor of #248.

@svara svara closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants