gymnocarpa
gymnocarpa
TTCTheo's Typesafe Cult
Created by barry on 11/30/2023 in #questions
drizzle + express + ts errors
status(201).redirect("/login"); feels like the most likely cause. I would be the header that is being updated is the status header, as function tries to set the header to 201 and then 301. I think you need one or the other?
4 replies
TTCTheo's Typesafe Cult
Created by aditya on 11/3/2023 in #questions
UI and State not same after altering the state
It's not really an order, react uses the key to see if the same item has changed places in the array or if it is a new item. By using the key, react can determine if the an element got inserted, deleted or changed in order, this saves rerendering all things if instead one item got removed. If you use the index as the key, then you tell React that the first item is always the first item and the second one is always the second. This behavior is often missed as it's easy to trigger the child to rerender by passing in a callback or similar that causes the child components to rerender regardless. What to use as a key? really any unique id to each item in the array, for example your platform value might be unique in the array. If you really don't have a unique Id in the array, then the next thing to do is to generate an id for each item in your array in the zustand layer of logic, so that the IDs don't change across renders of the component
16 replies
TTCTheo's Typesafe Cult
Created by gymnocarpa on 5/17/2023 in #questions
Outputting zod definitions for use in a different codebase
I have, what ever zod functions are used, tsc doesn't realise that it doesn't actually need the zod library
3 replies
TTCTheo's Typesafe Cult
Created by c1ub on 5/17/2023 in #questions
Is there a way in Zod to validate a field in a schema conditionally on another fields value?
I like using unions or discriminated unions in some cases like this, really depends
4 replies