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

Dev builds make __data.json?x-sveltekit-invalidated=01 requests even if +page.server* does not export a load function #10022

Open
torablien opened this issue May 24, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@torablien
Copy link

torablien commented May 24, 2023

Describe the bug

I have some routes with forms where I define form actions in their +page.server files. None of these +page.server files have a load function.

I noticed a bit of lag (~300ms) when navigating to those pages in dev builds, which looks to be coming from __data.json?x-sveltekit-invalidated=01 requests which always return: {"type":"data","nodes":[{"type":"skip"},{"type":"skip"},{"type":"data","data":[null],"uses":{}}]}. It seems like I can workaround this by removing the individual +page.server files on each route and moving them to a special, dedicated route that wouldn't be loaded by users, but that feels less than ideal.

It looks like this issue was filed before and fixed:

Is it expected for this to still happen in dev builds? It's not a big deal since it's seemingly in dev builds only, but it led to some confusion since we thought we had accidentally introduced latency we didn't expect until we tested outside of dev.

I made a minimal reproduction in Stackblitz with an empty +page.server file and see the same issue.

Is there a recommended or conventional approach on the placement of such form actions (e.g. in a dedicated route which avoids this also in dev)? Thanks!

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-gegmdq?file=src%2Froutes%2Fpage3%2F%2Bpage.svelte.

Logs

No response

System Info

Stackblitz:

 System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.5.0 => 1.18.0 
    svelte: ^3.54.0 => 3.59.1 
    vite: ^4.3.0 => 4.3.8

Severity

annoyance

Additional Information

No response

@torablien torablien changed the title Sveltekit makes __data.json?x-sveltekit-invalidated=01 requests even if +page.server* does not export a load function Sveltekit makes __data.json?x-sveltekit-invalidated=01 requests even if +page.server* does not export a load function May 24, 2023
@torablien torablien changed the title Sveltekit makes __data.json?x-sveltekit-invalidated=01 requests even if +page.server* does not export a load function Dev builds make __data.json?x-sveltekit-invalidated=01 requests even if +page.server* does not export a load function May 24, 2023
@hectordufau
Copy link

hectordufau commented Jun 21, 2023

I have the same issue when build using adapter-static and deploying on a Firebase Hosting.

image

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

No branches or pull requests

3 participants