rsnext/test/e2e/app-dir/interception-route-prefetch-cache
Zack Tanner 6545783be3
fix router prefetch cache key to work with route interception (#59861)
### What?
When handling route interception in two different segments but handled
by the same interception route, the first interception will show the
correct component but attempting the same interception on another
segment will return elements from the first request, not the second.

### Why?
Prefetch cache entries are created from the browser URL. However, route
interception makes use of `nextUrl` to mask the underlying components
that are being fetched from the server to handle the request

Consider the following scenario:

```
app
   foo
     @modal
       (...)post
         [id]
   bar
     @modal
       (...post)
         [id]
   post
     [id]
     
```
If you trigger an interception on `/foo`, your URL is going to be masked
to `/post/1` and keyed as such in the prefetch cache. However, the cache
entry is actually associated with `app/foo/@modal/(...post)/[id]`. That
means when you trigger the same interception on `/bar`, it will return
the tree from `/foo`.

### How?
This PR will prefix the prefetch cache key with `state.nextUrl` when
necessary.

Fixes #49878
Fixes #52748
Closes NEXT-1818
2023-12-22 13:10:37 -08:00
..
app fix router prefetch cache key to work with route interception (#59861) 2023-12-22 13:10:37 -08:00
interception-route-prefetch-cache.test.ts fix router prefetch cache key to work with route interception (#59861) 2023-12-22 13:10:37 -08:00