sonor
sonor
TTCTheo's Typesafe Cult
Created by sonor on 12/22/2023 in #questions
What's the right way to solve this?
<InputRow>
<Dropdown
title="Lora Name"
values={LoraNames.map((t) => ({ name: t, value: t }))}
value={lora_stack_item.name}
setValue={(value: z.infer<typeof LoraStackItem>["name"]) => {
const updatedLoraStack = [...efficiencyLoader.lora_stack.stack];
if (!updatedLoraStack[index]) return;
updatedLoraStack[index] = { ...updatedLoraStack[index], name: value };
setEfficiencyLoader({
...efficiencyLoader,
lora_stack: { ...efficiencyLoader.lora_stack, stack: updatedLoraStack },
});
}}
/>
</InputRow>
<InputRow>
<Dropdown
title="Lora Name"
values={LoraNames.map((t) => ({ name: t, value: t }))}
value={lora_stack_item.name}
setValue={(value: z.infer<typeof LoraStackItem>["name"]) => {
const updatedLoraStack = [...efficiencyLoader.lora_stack.stack];
if (!updatedLoraStack[index]) return;
updatedLoraStack[index] = { ...updatedLoraStack[index], name: value };
setEfficiencyLoader({
...efficiencyLoader,
lora_stack: { ...efficiencyLoader.lora_stack, stack: updatedLoraStack },
});
}}
/>
</InputRow>
Typescript error: updatedLoraStack[index] might be undefined, but we check it's not in the line before If I set updatedLoraStack[index] as a variable, check if its undefined and then set it, it won't update the original array
12 replies
TTCTheo's Typesafe Cult
Created by sonor on 12/15/2023 in #questions
How to pass tRPC types?
No description
5 replies
TTCTheo's Typesafe Cult
Created by sonor on 11/28/2023 in #questions
T3 & Mongoose
I have an existing Discord bot which uses Mongoose to keep track of who uses it and store values relating to their account If I wanted to make a T3 app for the discord bot, how can I integrate my existing Mongoose database with NextAuth to allow users to login on the site @Josh
37 replies