Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallthrough routes (2 routes with slugs on same level) Regression issue .137 #2041

Closed
zwergius opened this issue Jul 30, 2021 · 7 comments · Fixed by #2072
Closed

Fallthrough routes (2 routes with slugs on same level) Regression issue .137 #2041

zwergius opened this issue Jul 30, 2021 · 7 comments · Fixed by #2072
Labels
bug Something isn't working
Milestone

Comments

@zwergius
Copy link

Describe the bug

I cannot make a route fallthough when in SSR, this works as expected when client is navigating

This also affects when I export with static-adapter as all these routes return 500

Reproduction

This issue only appears in SSR mode, I reproduce by going to the route in question and refreshing (F5)

I have 2 routes:

src/routes/[legal]/index.svelte
src/routes/[page]/index.svelte

I manually check in my load function inside src/routes/[legal]/index.svelte
if (!validRoute) return

But this never reaches the load function in src/routes/[page]/index.svelte I see a 500 Internal server error in my console and the page shows the following message:

Bad request in load function: “failed to fetch undefined”

Logs

No response

System Info

System:
    OS: macOS 11.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 4.60 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.5.0 - ~/.n/bin/node
    Yarn: 1.22.10 - ~/.n/bin/yarn
    npm: 7.19.1 - ~/.n/bin/npm
  Browsers:
    Brave Browser: 91.1.26.77
    Chrome: 92.0.4515.107
    Firefox: 89.0.2
    Safari: 14.1.2
    Safari Technology Preview: 15.0
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.7 => 1.0.0-next.13 
    @sveltejs/kit: ^1.0.0-next.109 => 1.0.0-next.138 
    svelte: ^3.40.1 => 3.41.0 
    vite: ^2.1.0 => 2.4.4

Severity

blocking an upgrade

Additional Information

No response

@dominikg
Copy link
Member

Relevant discord discussion: https://discord.com/channels/457912077277855764/819723698415599626/870554215091683339

From Rainlife's comment it looks like this worked in .136 and broke with .137

@UltraCakeBakery
Copy link

all my route-name/index.svelte routes are broken now too. route-name.svelte is fine though. It simply returns no handler to me. I think it worked fine in version .136

@benmccann benmccann added the bug Something isn't working label Jul 30, 2021
@benmccann
Copy link
Member

Hmm. 137 enabled strict TypeScript checking: https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md#100-next137

It's a pretty big diff, so not easy to narrow down from the diff what might have changed

Can either of you provide a repository that reproduces this?

@benmccann benmccann added this to the 1.0 milestone Jul 30, 2021
@JulienPradet
Copy link

Hi @benmccann,

Here is a reproduction repo that contains two issues I've noticed: https://github.com/JulienPradet/sveltekit-2041

  • index.svelte + index.js conflict : previously, if an endpoint had no get method, it was using the index.svelte file as a fallback. http://localhost:3000/ displays no handler in the newer versions.
  • between [legal].svelte and [page].svelte, if the load function of the [legal].svelte didn't return anything, it should fallback to the [page].svelte (so in the case of the repository, http://localhost:3000/valid should display "Legal" but http://localhost:3000/invalid should display "Page"

I couldn't reproduce @UltraCakeBakery's issue though but I guess it's close to the endpoint issue.

@benmccann
Copy link
Member

benmccann commented Aug 1, 2021

We have tests for fallthrough, but it turns out they're not running 🤷 #2069

@benmccann
Copy link
Member

Tests are now running and failing. Now they need to be fixed

@harvey-k
Copy link
Contributor

harvey-k commented Aug 3, 2021

@benmccann Not sure if this is helpful, but the more complicated test seems to have broken in the commit below:
bce1d76#diff-f8956b07fb67847bf592e4b63a47d10053d7bdd1b484a4897eb385aab567dd2d

The specific file linked is part of what you changed in #2072

Your efforts are appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants