Huilen
Huilen
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Huilen on 1/30/2025 in #questions
what should i unit test and what shouldn't I?
Hi, a dev new to unit testing here! I'm wondering if, in a typescript project, should i test functions against runtime or not. example:
function iReceiveAString(arg:string){
//
}

// should I test this?
expect(iReceiveAstring(1234)).toThrow()
function iReceiveAString(arg:string){
//
}

// should I test this?
expect(iReceiveAstring(1234)).toThrow()
should i test that functions throw errors if arguments do not match what is typed? for me, i think that it isnt useful, since as the project has typescript, therefore a type checking script when compiling, those kind of errors will appear there if not shown by the linter before. what do you think? what is the "standard" for this? would love some advice!
12 replies
TTCTheo's Typesafe Cult
Created by Huilen on 7/13/2024 in #questions
is it wrong to call myself a software engineer if i didn't go to college
I saw some hot takes on how bad it was to call yourself a "software engineer" when you're just a "developer" (it was a long time ago, so I don't remember the entire argument, but now I have that idea in my head). are there differences between a developer and an engineer?
12 replies
TTCTheo's Typesafe Cult
Created by Huilen on 6/24/2024 in #questions
redirect on server action works depending on route ?
No description
2 replies
DTDrizzle Team
Created by Huilen on 6/20/2024 in #help
feedback on my database design (specially with relationships)
No description
1 replies
TTCTheo's Typesafe Cult
Created by Huilen on 6/8/2024 in #questions
Next js build success locally, but throws errors on vercel
I'm not using useContext, nor useSearchParams nor have modified the error pages.
6 replies
TTCTheo's Typesafe Cult
Created by Huilen on 5/17/2024 in #questions
calling server action from client sido throws webpack error - default webpack config
I'm trying to use a server action and when i run it i get
TypeError: __webpack_modules__[moduleId] is not a function
at Object.__webpack_require__ [as require] (/home/huilensolis/dev/projects/Pictura/.next/server/webpack-runtime.js:33:42)
TypeError: __webpack_modules__[moduleId] is not a function
at Object.__webpack_require__ [as require] (/home/huilensolis/dev/projects/Pictura/.next/server/webpack-runtime.js:33:42)
my component:
"use client";

import { createDefaultProfile } from "@/actions/create-profile";
import { PlainButton } from "@/components/ui/buttons/plain";
import { useSupabase } from "@/hooks/use-supabase";
import { ClientRouting } from "@/models/routing/client";
import { VenetianMask } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";

export function SignInAnonymouslyBtn() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");

const { supabase } = useSupabase();

const router = useRouter();

async function SignInAnonymously() {
setLoading(true);

try {
const { error } = await supabase.auth.signInAnonymously();
await createDefaultProfile();

router.push(ClientRouting.app);
} catch (error) {
console.log({ error });
}
}

return (
<>
<PlainButton
className="bg-indigo-600 dark:bg-indigo-700 text-neutral-50"
isLoading={loading}
disabled={loading}
onClick={SignInAnonymously}
>
Sign In Anonymously <VenetianMask />
</PlainButton>
{error && <p className="dark:text-red-500">{error}</p>}
</>
);
}
"use client";

import { createDefaultProfile } from "@/actions/create-profile";
import { PlainButton } from "@/components/ui/buttons/plain";
import { useSupabase } from "@/hooks/use-supabase";
import { ClientRouting } from "@/models/routing/client";
import { VenetianMask } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";

export function SignInAnonymouslyBtn() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");

const { supabase } = useSupabase();

const router = useRouter();

async function SignInAnonymously() {
setLoading(true);

try {
const { error } = await supabase.auth.signInAnonymously();
await createDefaultProfile();

router.push(ClientRouting.app);
} catch (error) {
console.log({ error });
}
}

return (
<>
<PlainButton
className="bg-indigo-600 dark:bg-indigo-700 text-neutral-50"
isLoading={loading}
disabled={loading}
onClick={SignInAnonymously}
>
Sign In Anonymously <VenetianMask />
</PlainButton>
{error && <p className="dark:text-red-500">{error}</p>}
</>
);
}
my server action:
"use server";

export async function createDefaultProfile() {
console.log('hello world')
}
"use server";

export async function createDefaultProfile() {
console.log('hello world')
}
I'm using multiple server actions in my project, and none of them throws this error, they work fine.
27 replies
TTCTheo's Typesafe Cult
Created by Huilen on 3/31/2024 in #questions
Im a newbie creating a document editor and idk how to setup an architecture to save the data
No description
16 replies
TTCTheo's Typesafe Cult
Created by Huilen on 3/28/2024 in #questions
why 401 status code doesn't trigger `response.ok` to be false?
hi, i think this is a misunderstanding of the fetch API. Is response.ok a boolean to validate if the request was succesfull or to validate if the request was sent successfully?
7 replies
TTCTheo's Typesafe Cult
Created by Huilen on 3/11/2024 in #questions
how to re-validate a layout on a dynamic page?
i have a route /app/projects/[id] with a layout that displays information about the project. i want to revalidate the path layout when i update the project information. how can i do it? i tried to move the update function to a server action and use revalidatePath('/app/projects/[id]', 'layout') but it doesn't work. im using app router btw
2 replies