Mordi
Mordi
TTCTheo's Typesafe Cult
Created by Mordi on 1/12/2024 in #questions
server side auth & react query
or am I silly for moving away from using sessionProvider
4 replies
TTCTheo's Typesafe Cult
Created by Mordi on 1/12/2024 in #questions
server side auth & react query
4 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
creating a new question/thread so that anyone in a similar situation doesn't have to go through 50+ messages
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
I don't see how I can create the onChange/updater function without getting the same type errors. so in the same component as the component as the state was initialized in we create a onChange function:
const urlUpdateHelper = (urls: {url: string, partNumber: number }[] | {url: string, partNumber: number}) => {
setpartPresignedUrls((prevState) => [...prevState], urls]);
}
const urlUpdateHelper = (urls: {url: string, partNumber: number }[] | {url: string, partNumber: number}) => {
setpartPresignedUrls((prevState) => [...prevState], urls]);
}
this still returns the same error message What I did in the dropzone-component was:
const Dropzone = ({setPresignedUrl}: {setPresignedUrl: (e: { url: string; partNumber: number; } | { url: string; partNumber: number; }[]) => void;}) => {
...
setPresignedUrl(urls);
}
const Dropzone = ({setPresignedUrl}: {setPresignedUrl: (e: { url: string; partNumber: number; } | { url: string; partNumber: number; }[]) => void;}) => {
...
setPresignedUrl(urls);
}
and for passing props:
<Dropzone setPartPresignedUrl={(e) => urlUpdateHelper(e)} ..
<Dropzone setPartPresignedUrl={(e) => urlUpdateHelper(e)} ..
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
Should I post a new question titled something like "typedefs & usage of useStates with object arrays" ?
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
so setPresignedUrl: {(newPresignedUrl: string): void} doesn't work. It has to be something like: setPresignedUrl: {(newPresignedUrl: {url: string, partNumber: number}[]): void}, but what I just wrote is not valid ts
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
oh yeah, I just looked at the init of the state and didn't think of the connection to the dropzone-component
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
but then I ended up putting any
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
I did keep the names different, didn't think it mattered as long as the types were the same
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
is this about the setPresignedUrl inside the dropzone-component?
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
I am:
presignedUrl: { [partNumber: number]: File; }[];
// TODO: add the correct typings to these
setPresignedUrl: any//(e: any) => void;
uploadId: string[];
setUploadId: any//(e: string[]) => void;
presignedUrl: { [partNumber: number]: File; }[];
// TODO: add the correct typings to these
setPresignedUrl: any//(e: any) => void;
uploadId: string[];
setUploadId: any//(e: string[]) => void;
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
its 360 lines
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
I will make a codesandbox
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
55 replies
TTCTheo's Typesafe Cult
Created by Mordi on 3/29/2023 in #questions
how come this returns undefined
but RHF doesn't mess with useStates does it? in my case partPresignedUrls is just useState object. ie:
const [partPresignedUrls, setPartPresignedUrls] = useState<
{ url: string; partNumber: number }[]>([]);
const [partPresignedUrls, setPartPresignedUrls] = useState<
{ url: string; partNumber: number }[]>([]);
55 replies