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

Wildcard [...path] has priority over a pre-rendered API route #11927

Closed
bpruissen opened this issue Mar 1, 2024 · 2 comments
Closed

Wildcard [...path] has priority over a pre-rendered API route #11927

bpruissen opened this issue Mar 1, 2024 · 2 comments

Comments

@bpruissen
Copy link

bpruissen commented Mar 1, 2024

Describe the bug

image

Goal: Pre-render a larger dataset as a pre-rendered API route, which can be used in a dynamic layout.

In the following structure the pre-rendered /api/global_container is reachable via the URL and working properly.
In the +layout.server.ts the /api/global_container is called and the [...path] catches this route while it should first be catched by the pre-rendered API route.

We tried several work-arounds, with folder structures, when the wildcard [...path] is removed the /api/global_container is reachable and everything works fine as expected. Also when we don't use the internal fetch and call http://localhost:4173/api/global_container than everything works as expected.

Also if I pre-render the root +layout.server.ts than it seems to work fine, but than I have the issue that all data collected in the layout.server.ts is pre-rendered.

Reproduction

image

If you have this structure and only prerender:
image

image

image

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
    Memory: 1.60 GB / 15.73 GB
  Binaries:
    Node: 18.19.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (122.0.2365.59)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.1.1
    @sveltejs/adapter-cloudflare: ^4.1.0 => 4.1.0
    @sveltejs/kit: ^2.0.0 => 2.5.2
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.0.2
    svelte: ^4.2.7 => 4.2.12
    vite: ^5.0.3 => 5.1.4

Severity

serious, but I can work around it

Additional Information

These calls are template related (header, footer data)

@eltigerchino
Copy link
Member

Please provide a minimal reproduction in the form a repository.

@dummdidumm
Copy link
Member

Closing in favor of #12778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants