hotshoe
Explore posts from serversroot.tsx & cookies
I need to read cookie data so I can setup my theme (i.e., an html data attribute) and load a script (based on runtime data), so need access to request object from within root.tsx.
A solution appears to be anything but straight-forward. I found a couple related threads (below) on loading data into root.tsx but I feel they lead down the wrong path for something that should be so simple. Is there an SS prescribed method for reading cookie data from root.tsx?
Thanks!
P.S. As an aside. Tried
root.data.ts
and works for passing in data via useRouteData, but it's undocumented afaict and isomorphic, and need it to be server only. If there's example of how to apply root.data.ts
for the use case described then that could work for me.
Any help much apprecaited!
Thanks,
-Roland.
related links:
https://discord.com/channels/722131463138705510/910635844119982080/1111155446368182302
https://github.com/solidjs/solid-start/issues/6472 replies
DTDrizzle Team
•Created by hotshoe on 4/24/2023 in #help
onUpdateNow usage
is onUpdateNow simlar to prisma's @updatedAt ? I.e., updated_at col is auto-updated. If so, is there an example usage? Thanks!
3 replies
DTDrizzle Team
•Created by hotshoe on 4/20/2023 in #help
many-to-one selection as array
Hi,
Let's say I have a user table, and the user can have multiple profiles. When I select using join on user_id I get back two records like so (pseudo-code):
What I want is a single record, where profiles are listed in an array on the user object:
Is there an elegant way for me to get query back in desired form (w/o needing to resort to two queries and patching together a new type)? Any help is much appreciated!
Thanks,
7 replies
DTDrizzle Team
•Created by hotshoe on 4/11/2023 in #help
many-to-one transaction
Hello,
I want to create transaction involving arbitrary number of inserts. For example, Artist (one table) and insert multiple Titles (another table). Not clear to me how to best accomplish based example provided:
Also, related, is there a way for me to include non db transactions as part of transaction, such that if exception thrown say, for example, copy object to S3 bucket fails, transaction also rolls back?
Thanks!
6 replies
DTDrizzle Team
•Created by hotshoe on 4/4/2023 in #help
compound uniqueIndex
In Prisma, I have in my schema definition the following declaration that requires userId and timestamp tuple to be unique:
How can I express the same using drizzle kit schema file?
4 replies
DTDrizzle Team
•Created by hotshoe on 4/4/2023 in #help
planetscale: how to index col using drizzle?
Hi, seems most of the samples are pg. I'm using planetscale, and no having any luck figuring out how to index a col. here's simple table I'm wanting to use to test/eval:
Any help much appreciated. Thanks!
5 replies
createResource mutations / page state
Hello,
For I'm using createResource for my solid-start project for fetching post user can interact with (like, comment, delete, etc.), have in suspense boundary, and functionally works great, and lends itself very nicely to optimistic UI when using mutate in conjunction w/ latest.
The problem is once refetch completes, the page state "flashes" and re-scrolls (depending on number of posts and where on screen when updated post). Any ideas how to address this issue?
Or any suggestions on better pattern? Since I'm using solid-start, would prefer to use a route loaders, but chose create resource because provides ability to optimistically render mutation state.
Thanks!
1 replies
createServerData$ question
Hi,
In example page below, why do I need to call
data()
in the export page function for the data to load (or to enable reactivity)?
It's not blocking me, but curious if I'm doing something wrong, and seems like it should be unnecessary, esp. since data
is referenced in the templated section.
Thanks!
6 replies
get cookie inside $server rpc call
Hi, how can I get an http cookie inside $server rpc context? This is possible using tRPC, and I'm hoping possible w/ $server because it's working out well for me, and I'd hate pull in tRPC just to get a cookie. (edit: or make rest API call, which is prob what will do on second thought if not supported, but bummer to lose the easy type safety)
5 replies
Can a Solid store contain class objects?
Can a Solid store contain class objects?
When I implement a simple type like below as a class, reactivity breaks for me when surfacing in a Solid store via a context provider.
Do Solid store objects need to be pojos?
12 replies
invalidateAll
Is there SS equivalent to SvelteKit invalidateAll? (https://kit.svelte.dev/docs/modules#$app-navigation-invalidateall)
The use case is when the user updates their profile (e.g, change profile photo or user handle), want to update session state so changes are reflected (by requerying it from server), and w/o a page refresh.
4 replies
Any workarounds or guidance for circular dependency warnings?
I realize Vite issue, but I was able to resolve in SvelteKit and no such luck (yet) w/ SS. Specifically, inclusion if AWS S3 client module is resulting in a lot of circular dependency spew at build time. W/ Svelte using node adapter, just need to regular dep (instead of dev dependency) so module doesn't get rolled-up, resulting in clean build output. Everything seems to be working fine, but the number of warnings being generated is unsettling. Same problem w/ auth-core, but to much lesser extent. Somebody has to have run into this w/ SS given S3 client usage. Any workarounds for SS, or folks just ignoring?
Related thread: https://github.com/aws/aws-sdk-js-v3/issues/4435
2 replies
Breaking out proxied Stores object as a signal (while retaining reactivity)
Let's say I have an album object...
, composed as Store array....
Now, the user can swipe through using Swiper (or similar), which Solidjs makes wonderfully straight-forward to implement using
For
control "tag".
Question: What is the best Solid pattern for passing selected item as a property to a properties page while retaining reactivity? In other words, when the user clicks (selects) a Swiper slide, a callback fn sends the id
, which is used to bind the properties page (enabling user to add/edit the Album property fields).
I understand from watching some of Ryan's videos (so helpful and insightful!) that a Store is composed of signal primitives, so, in theory (I think ¯\_(ツ)_/¯) , I should be able to get at a proxied object and pass it as a signal, just as if I were passing a signal as a property. The alternative is to pass the store and the id to the props page (or break it out into context), but I'd prefer to be surgical, but not clear to me how to go about handling. Any ideas much appreciated? I'm still very much getting my feet wet w/ SolidJS (just a couple days into it), so apologies in advance if covered in the doc (I did check).
Thanks!
-Roland.9 replies
contextProvider using signal
Hi, noob question here -- just getting feet wet w/ SolidStart. Any help is appreciated!!
Trying to create a context provider for setting theme, and prop is getting passed down but child comps not reacting.
(cont'd)
26 replies
$server v. tRPC
Hello, I'm kicking the tires on solid start and it looks amazing! (been using svelte-kit for past couple months for a project, but decided to give solid-start a try before getting deep in). One noob question I have is being able to make rpc call by simply defining $server function is -- like I said -- A M A Z I N G !!! -- so, why are folks using tRPC? (unless to other server backend).
2 replies