S
SolidJS3mo ago
gsoutz

Passing State between different routes

Do you think this is a good idea to pass data between different pages using solid router. class SessionStore { navigate_filter?: string } export default new SessionStore() , So before navigate('/dashboard'), I do SessionStore.navigate_filter = 'hello', then read the state in dashboard page, how cool is that?
4 Replies
peerreynders
peerreynders3mo ago
What you have to ask yourself: If I was to server-side render this page, would I need to know this information? If you need the info to accurately render the page on the server then it should be somehow expressed directly in the url. Otherwise its volatile/ephemeral, possibly specific to the device and it's OK to use SessionStorage or IndexedDB for that. https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
MDN Web Docs
IndexedDB API - Web APIs | MDN
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solut...
gsoutz
gsoutz3mo ago
Not what I asked, I don't use SessionStorage, I just called my class SessionStore, it's just cache in memory, would that also be ok?
peerreynders
peerreynders3mo ago
Depends entirely on the nature of the information. If it's ephemeral then it's OK. Otherwise it must be referenced in the URL in one way or another.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server
More Posts
Solid Contexts with Astro for authenticationI am writing a reusable context for authenticating with Auth0, and there are two parts to it. LogginIssue subscribing to store changesI am having trouble understanding why the onClick event of my button in this playground code snippetI have no clue what I am doing wrongHello, I am very new to Solid, I am working with stores right now to represent this data structure: How can I only set the ref for an element once it's been inserted into the DOM?I've tried a few things but it doesn't seem like the element is inserted to the DOM at the point wheIntersection Observer IssuesI'm working on a game and I want some elements to animate in when they become visible, so I'm using what write so as not to constantly write a redirect in every function in case of unauthorizeI don’t have a database on the solidstart server, I only work with third-party APIs. Where to store Solid doesn't re-render when update the same array in createSignalExpected behavior: Re-render inputs every time passwords array is updated even with the same value,For some reason <select> doesn't work correctlyhttps://playground.solidjs.com/anonymous/eedf65f3-e52b-49b0-a8b2-513465a75666 Here it is. When changCan someone tell me how to redirect the user on each API, if 401, that is, do not write the logic agCan someone tell me how to redirect the user on each API, if 401, that is, do not write the logic agHow to use web component in solidjsPlease ask solidjs how to solve the use of web component component editor ts reported error Property