question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PageData types don't update to reflect changes to load function(s)

See original GitHub issue

Describe the bug

Having a +page.server.ts load function with no +page.ts load function results in PageData being any

Making changes to +page.ts load function means the PageData types lag and mismatch.

Reproduction

Just add and remove some static props to the load function return object.

Logs

No response

System Info

System:
    OS: macOS 12.5
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 1.56 GB / 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: 104.0.5112.79
    Chrome Canary: 106.0.5243.0
    Firefox: 103.0.2
    Safari: 15.6
    Safari Technology Preview: 16.0
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.64 
    @sveltejs/kit: next => 1.0.0-next.411 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.0 => 3.0.8

Severity

annoyance

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dummdidummcommented, Aug 17, 2022

@CaptainCodeman could you check if your errors still persist? I’m having trouble to figure out if this is one or multiple issues. The “type doesn’t update” issue should be resolved in the latest Svelte for VS Code extension version.

1reaction
sandstromdevcommented, Aug 17, 2022

I’ve noticed the same thing with all exports of ./$types. If you open the ./$types file, all exports are typed correctly, but when importing them from a +page.svelte, they are typed as any, unknown or never.

As @AdrianGonz97 mentioned, reloading vscode helps, so my guess is that the problem is in vscode not reading the files on each update.

+page.server.ts Screenshot 2022-08-17 at 12 42 51

+page.svelte Screenshot 2022-08-17 at 12 43 18

Read more comments on GitHub >

github_iconTop Results From Across the Web

SvelteKit - api response data (PageData) not updated after ...
If a load function is triggered to re-run, the page will not remount — instead, it will update with the new data ....
Read more >
Sveltekit Changes: Load Function - DEV Community ‍ ‍
In this article i'm going to explain you about new changes in load function of sveltekit framework. How it is changes after sveltekit...
Read more >
Loading data • Docs • SvelteKit
Notice that the type changed from PageLoad to PageServerLoad , because server load functions can access additional arguments. To understand when to use ......
Read more >
WordPress Changes Not Showing? 3 Methods to Fix It Right ...
When WordPress is not showing changes right away, it is most likely still displaying a cached version. Learn three ways to fix this...
Read more >
Load and display paged data - Android Developers
On this page · Define a data source. Select key and value types; Define the PagingSource; Handle errors · Set up a stream...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found