manubaun
manubaun
Explore posts from servers
SSolidJS
Created by manubaun on 11/15/2024 in #support
I get ERR_UNHANDLED_REJECTION
the idea is, to show some extra infos and options when user is logged in. in the drizzle example it uses it on a page like here:
import { createAsync, type RouteDefinition } from "@solidjs/router";
import { getUser, logout } from "~/api";

export const route = {
preload() {
getUser();
}
} satisfies RouteDefinition;

export default function Home() {
const user = createAsync(async () => getUser(), { deferStream: true });
return (
<main class="w-full p-4 space-y-2">
<h2 class="font-bold text-3xl">Hello {user()?.username}</h2>
<h3 class="font-bold text-xl">Message board</h3>
<form action={logout} method="post">
<button name="logout" type="submit">
Logout
</button>
</form>
</main>
);
}
import { createAsync, type RouteDefinition } from "@solidjs/router";
import { getUser, logout } from "~/api";

export const route = {
preload() {
getUser();
}
} satisfies RouteDefinition;

export default function Home() {
const user = createAsync(async () => getUser(), { deferStream: true });
return (
<main class="w-full p-4 space-y-2">
<h2 class="font-bold text-3xl">Hello {user()?.username}</h2>
<h3 class="font-bold text-xl">Message board</h3>
<form action={logout} method="post">
<button name="logout" type="submit">
Logout
</button>
</form>
</main>
);
}
`
8 replies
SSolidJS
Created by manubaun on 11/15/2024 in #support
I get ERR_UNHANDLED_REJECTION
used your code and yes, I cannot reproduce it either. Then tracked down the error. In my navbar I use a function called getUsers (all from the with-drizzle example) there it uses const user = createAsync(async () => getUser(), { deferStream: true }); this is somehow the function, where it all goes bad. I probably use createAsync wrong. https://stackblitz.com/edit/github-52ahab-xybqhj?file=src%2Froutes%2Findex.tsx,src%2Fserver.ts,src%2Fcomponents%2FNav.tsx note: In my Stackbliz example I get "Context is not available". On my Mac, I getht the ERR_UNHANDLED_REJECTION crash
8 replies
SSolidJS
Created by manubaun on 11/15/2024 in #support
I get ERR_UNHANDLED_REJECTION
in the loginOrRegister function, if the validation fails it create a new error and returns it. then the same issue happends ERR_UNHANDLED_REJECTION so its not even reaching redirect
8 replies
SSolidJS
Created by manubaun on 11/15/2024 in #support
I get ERR_UNHANDLED_REJECTION
In my frontend I use it like this <form action={loginOrRegister} method="post"> and function is wrapped in an action export const loginOrRegister = action(lOR, "login");
8 replies