Code Monkey home page Code Monkey logo

Comments (5)

paoloricciuti avatar paoloricciuti commented on June 24, 2024

Calling the function returns a writable store that you can pass to the derived. What kind of calculations you need to do?

from sveltekit-search-params.

ewal avatar ewal commented on June 24, 2024

I have tried calling the queryParameters function in the derived store but I get the following error:

Error: Cannot subscribe to 'page' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.For more information, see https://kit.svelte.dev/docs/state-management#avoid-shared-state-on-the-server

(I basically want to filter a store based on the values in the query params).

from sveltekit-search-params.

ewal avatar ewal commented on June 24, 2024

I found a solution by subscribing to the queryParameters() store from where I update another store that can used in the derived store. Bit of a overhead perhaps but works fine 👍

from sveltekit-search-params.

paoloricciuti avatar paoloricciuti commented on June 24, 2024

Than its a different problem: you are trying to subscribe to the store in the load function but this is a security issue.

You should just use this store inside a svelte component

from sveltekit-search-params.

ewal avatar ewal commented on June 24, 2024

Strange, because I got the error when I tried to use the queryParameters store inside a derived store 🤔 (Not subscribing to it, that is). Anyway, I kinda realized I have all I need inside the $page object so I will close this issue now... Thank you for your replies.

from sveltekit-search-params.

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.