#Two routes at the root, but one uses a prefix?
4 messages · Page 1 of 1 (latest)
It should be possible, could you provide a reproduction? You can fork one of the stackblitz examples
FWIW unit tests seem to be OK w/ that case. So now I'd really need to see a repro to understand the issue
describe.only('repro', () => {
it('matches two root routes', () => {
const tree = {
id: '__root__',
isRoot: true,
fullPath: '/',
path: '/',
children: [
{
id: '/_main/@{$username}/',
fullPath: '/@{$username}/',
path: '@{$username}/',
},
{
id: '/$publicationSlug/',
fullPath: '/$publicationSlug/',
path: '$publicationSlug/',
},
],
}
const { processedTree } = processRouteTree(tree)
{
const result = findRouteMatch('/foobar', processedTree)
expect(result?.route.id).toBe("/$publicationSlug/")
expect(result?.rawParams).toEqual({ "publicationSlug": "foobar" })
}
{
const result = findRouteMatch('/@foobar', processedTree)
expect(result?.route.id).toBe('/_main/@{$username}/')
expect(result?.rawParams).toEqual({ "username": "foobar" })
}
})
})
@severe moon are you on latest?