solidjs / solid-docs

SolidJS Docs.
https://docs.solidjs.com/
227 stars 271 forks source link

[Content]: #948

Closed tsoumdoa closed 1 hour ago

tsoumdoa commented 2 hours ago

📚 Subject area/topic

Wrong function used for the code example

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/solid-start/building-your-application/data-loading

📋 Description of content that is out-of-date or incorrect

I think the

I believe the function imported for the following code example is wrong, should it not use cache instead of query? My LSP tells me that query doesn't exist so I've assumed that it needs to be query as opposed to use query? I'm quite new to solid so apology in advance if it's my misunderstanding...

/routes/users.tsx and /routes/users.js) for Data loading always on the server

- import { createAsync, query } from "@solidjs/router";
+ import { createAsync, cache } from "@solidjs/router";

- const getUsers = query(async () => {
+ const getUsers = cache(async () => {

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

tsoumdoa commented 1 hour ago

My bad, I looked at the doc for cache and realised that I was on @solidjs/router ^0.14.10, I just updated to 0.15.1 and it works as documented. I'll close it now, sorry...