Skip to content

Endpoint Fallthrough Bug #4212

@lemmon

Description

@lemmon

Describe the bug

Problem happens when you have multiple dynamic routes at the same level. Example:

[page]/index.js
[page]/index.svelte
[project]/index.js
[project]/index.svelte

Expected behavior is that you first check whether the [page] is a valid page. If yes, you return props and render the page. If NOT you should be able to return { fallthrough: true } and kit will process the next route, [project], in this case.

However it doesn't work when you use endpoints shadowing the route. It works as expected when using load() function within the svelte component file. It works on first render or full page refresh. However it breaks when navigating. SvelteKit somehow gets stuck on [page]/index.svelte component and renders itself instead of falling through to the next one.

Reproduction

https://github.com/lemmon/svelte-kit-fallthrough-endpoint-bug

Logs

No response

System Info

System:
    OS: macOS 11.6.3
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
    Memory: 203.37 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.1 - /usr/local/bin/node
    npm: 8.5.1 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 88.1.19.86
    Chrome: 98.0.4758.109
    Firefox: 97.0.1
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-auto: 1.0.0-next.30 => 1.0.0-next.30 
    @sveltejs/kit: 1.0.0-next.291 => 1.0.0-next.291 
    svelte: ^3.44.0 => 3.46.4

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions