Giter Club home page Giter Club logo

Comments (7)

ardeora avatar ardeora commented on May 30, 2024 1

@PeterDraex Sorry slight regression. Fix should be up soon #7300

from query.

PeterDraex avatar PeterDraex commented on May 30, 2024

@ardeora After update from 5.30.3 to 5.30.5 I'm getting an error in queries that use enabled:

The value [object Function] of type "function" cannot be parsed/serialized.

https://stackblitz.com/edit/github-pqy8j7-jw28rz?file=package.json,src%2Fcomponents%2FPage.tsx

from query.

PeterDraex avatar PeterDraex commented on May 30, 2024

@ardeora Can you make this work with placeholderData: keepPreviousData? Right now, it's triggering Suspense on load. I'd like the server data to be considered previous data.

from query.

ardeora avatar ardeora commented on May 30, 2024

@PeterDraex
This wont be possible because you're essentially changing the query key before the query is hydrated. So on the client query doesnt know the data of the server rendered query. One workaround is passing the server data as initialData shown here

https://stackblitz.com/edit/github-pqy8j7-bzfkzw?file=package.json,src%2Fcomponents%2FPage.tsx

One other way would be to expose an onHydrated callback on each query where you can provide logic after a query has been hydrated. But that's not planned at the moment! If you would like that please feel free to open a new issue and I'll put it on my backlog!

from query.

PeterDraex avatar PeterDraex commented on May 30, 2024

@ardeora I don't see initialData in the stackblitz. Maybe you forgot to hit save? 😀

from query.

ardeora avatar ardeora commented on May 30, 2024

@PeterDraex Oops yes I did 😀 https://stackblitz.com/edit/github-pqy8j7-bzfkzw?file=package.json,src%2Fcomponents%2FPage.tsx

from query.

PeterDraex avatar PeterDraex commented on May 30, 2024

@ardeora I see, I was hoping to see some trick to actually get the data that was loaded on the server, without calling the API manually function again 😆

I feel like callback on full completion of hydration should be implemented on the level of SolidJS APIs, not via Solid Query's callback. I'm surprised that the query is not hydrated yet when onMount is called and isHydrated is true, though I understand that there might be some upstream limitations there. Combination of onMount and setTimeout seems to be working ok, so I'll use that for now:

onMount(() => setTimeout(() => setIsQueryHydrated(true), 0));

Thank you!

from query.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.