kit icon indicating copy to clipboard operation
kit copied to clipboard

Hydrate options don't affect embedded props from page endpoints

Open CaptainCodeman opened this issue 3 years ago • 0 comments

Describe the bug

The hydrate option works to suppress data being embedded in the page if it is loaded from a standalone endpoint from a load function.

Using a shadow endpoint always embeds the data in the page, regardless of the hydrate option in the page itself or the svelte.config browser option.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-11tmmy?file=src/routes/test.svelte

View (frame) source for / and /test route.

The first contains: <script type="application/json" sveltekit:data-type="props">{"text":"some big long string"}</script> whereas a request for /test does not.

Both load the same data from the same endpoint, /test uses its own load function instead of the shadow endpoint mechanism kicking in.

Logs

No response

System Info

System:
    OS: macOS 12.5
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 26.04 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    npm: 8.3.1 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 102.1.39.111
    Chrome: 103.0.5060.134
    Chrome Canary: 106.0.5212.0
    Edge: 103.0.1264.77
    Firefox: 102.0.1
    Safari: 15.6
    Safari Technology Preview: 16.0
  npmPackages:
    @sveltejs/adapter-node: next => 1.0.0-next.85 
    @sveltejs/kit: next => 1.0.0-next.398 
    svelte: ^3.49.0 => 3.49.0 
    vite: ^3.0.3 => 3.0.4

Severity

serious, but I can work around it

Additional Information

No response

CaptainCodeman avatar Jul 31 '22 21:07 CaptainCodeman