navigation icon indicating copy to clipboard operation
navigation copied to clipboard

NavigationTransition.from.key is the same as NavigationDestination.key

Open absurdprofit opened this issue 9 months ago • 2 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [x] I have searched existing issues to ensure it has not already been reported

Version (i.e. v2.x.x)

1.0.1-alpha.202

Node.js version (i.e. 18.x, or N/A)

No response

Operating system

N/A

Operating system version (i.e. 20.04, 11.3, 10, or N/A)

N/A

Description

During a NavigateEvent interception the NavigationTransition.from on the navigation object has the same key as NavigationDestination on the NavigateEvent object. The key doesn't seem to be an existing history entry key. I've been using the API in chromium for a while now and built my router around that so I'm decently certain this is a bug.

Steps to Reproduce

  1. Apply the polyfill using the applyPolyfill function with history, interceptEvents, patch, persist and persistState config options set to true.
  2. Attach an event listener to window.navigation for navigation events.
  3. Observe the key on navigation.transition.from and event.destination.

Expected Behavior

When NavigateEvent.navigationType is push the key should be empty. When NavigateEvent.navigationType is traverse, replace or reload the key should be an existing history entry key.

absurdprofit avatar Apr 28 '24 01:04 absurdprofit

Would it be possible to reproduce this as an example by chance?

e.g. https://github.com/virtualstate/navigation/blob/main/example/webcomponents.html

It can include assertions as to what should be expected.

fabiancook avatar Apr 28 '24 08:04 fabiancook

Sure, here's the example. Navigate to any route and an assertion is thrown.

absurdprofit avatar Apr 28 '24 13:04 absurdprofit