febri
febri
SSolidJS
Created by febri on 8/26/2024 in #support
Signal lost its reactivity when passed into another function
i shouldve pursue farming instead
6 replies
SSolidJS
Created by febri on 8/26/2024 in #support
Signal lost its reactivity when passed into another function
and youre right
6 replies
SSolidJS
Created by febri on 8/26/2024 in #support
Signal lost its reactivity when passed into another function
really
6 replies
SSolidJS
Created by febri on 8/26/2024 in #support
Signal lost its reactivity when passed into another function
bruh
6 replies
SSolidJS
Created by febri on 8/19/2024 in #support
solid-transition-group not working inside createRoot
problem is solid-transition-group dont work, as you can see im animatiing it manually
7 replies
SSolidJS
Created by febri on 8/19/2024 in #support
solid-transition-group not working inside createRoot
which is alot more make sense
7 replies
SSolidJS
Created by febri on 8/19/2024 in #support
solid-transition-group not working inside createRoot
so now i can just call save_quizz_form().then(name => savesomewhere(name)).catch((err) => somerrorhandling)
7 replies
SSolidJS
Created by febri on 8/19/2024 in #support
solid-transition-group not working inside createRoot
and then i use that modal to create a prompt for inputting name
export default function save_quizz_form(): Promise<string> {
return new Promise((resolve, reject) => {
const modal = Modal("Save Quizz", () => { reject("Aborted.") }, () => {
let name = "";
return (
<form class="flex items-center gap-2" onsubmit={(e) => {
e.preventDefault();
e.stopImmediatePropagation();
resolve(name);
modal.close()
}}>
<input type="text" onchange={(e) => name = e.target.value} placeholder="Template name" class=" px-2 outline-none border rounded-md" />
<button type="submit"><AiOutlineSave size="1.5em" color="black" /></button>
</form>
)
})
});
}
export default function save_quizz_form(): Promise<string> {
return new Promise((resolve, reject) => {
const modal = Modal("Save Quizz", () => { reject("Aborted.") }, () => {
let name = "";
return (
<form class="flex items-center gap-2" onsubmit={(e) => {
e.preventDefault();
e.stopImmediatePropagation();
resolve(name);
modal.close()
}}>
<input type="text" onchange={(e) => name = e.target.value} placeholder="Template name" class=" px-2 outline-none border rounded-md" />
<button type="submit"><AiOutlineSave size="1.5em" color="black" /></button>
</form>
)
})
});
}
7 replies
SSolidJS
Created by febri on 8/19/2024 in #support
solid-transition-group not working inside createRoot
i use that to create a modal
export default function Modal(title: string, on_close: () => void, children: () => JSXElement) {
let close = () => { };
const pop = popup((
) => {
let bg: HTMLDivElement;
let modal: HTMLDivElement;
const animate_opt: KeyframeAnimationOptions = {
duration: 200,
fill: "forwards"
};
close = () => {
if (!bg || !modal) {
pop.close();
on_close();
return;
}

modal.animate([{ top: "50%", transform: "translate(-50%,-50%)" }, { top: "100vh", transform: "translate(-50%, 0)" }], { ...animate_opt, easing: "ease-in" })
on_close();
bg.animate([{ opacity: 1 }, { opacity: 0 }], { ...animate_opt, easing: "ease-in" }).finished.then(() => {
pop.close();
})
}

createEffect(() => {
if (!bg || !modal) {
return;
}
bg.animate([{ opacity: 0 }, { opacity: 1 }], { ...animate_opt, easing: "ease-out" });
modal.animate([{ top: "100vh", transform: "translate(-50%, 0)" }, { top: "50%", transform: "translate(-50%,-50%)" }], { ...animate_opt, easing: "ease-out" })
})

return (
<div class="absolute z-50 inset-0 overflow-hidden">
<div ref={bg} class="inset-0 absolute bg-[rgba(0,0,0,.3)]" onclick={
close
}>

</div>

<div ref={modal} class="border absolute left-1/2 rounded-md bg-white p-3 ">
<div class="flex justify-between items-center gap-4">
<span>{title}</span> <AiOutlineClose onclick={close} size="1.25em" class="cursor-pointer" />

</div>
<div class="mt-2">{children()}</div>
</div>
</div>
)
})
return { close };
}
export default function Modal(title: string, on_close: () => void, children: () => JSXElement) {
let close = () => { };
const pop = popup((
) => {
let bg: HTMLDivElement;
let modal: HTMLDivElement;
const animate_opt: KeyframeAnimationOptions = {
duration: 200,
fill: "forwards"
};
close = () => {
if (!bg || !modal) {
pop.close();
on_close();
return;
}

modal.animate([{ top: "50%", transform: "translate(-50%,-50%)" }, { top: "100vh", transform: "translate(-50%, 0)" }], { ...animate_opt, easing: "ease-in" })
on_close();
bg.animate([{ opacity: 1 }, { opacity: 0 }], { ...animate_opt, easing: "ease-in" }).finished.then(() => {
pop.close();
})
}

createEffect(() => {
if (!bg || !modal) {
return;
}
bg.animate([{ opacity: 0 }, { opacity: 1 }], { ...animate_opt, easing: "ease-out" });
modal.animate([{ top: "100vh", transform: "translate(-50%, 0)" }, { top: "50%", transform: "translate(-50%,-50%)" }], { ...animate_opt, easing: "ease-out" })
})

return (
<div class="absolute z-50 inset-0 overflow-hidden">
<div ref={bg} class="inset-0 absolute bg-[rgba(0,0,0,.3)]" onclick={
close
}>

</div>

<div ref={modal} class="border absolute left-1/2 rounded-md bg-white p-3 ">
<div class="flex justify-between items-center gap-4">
<span>{title}</span> <AiOutlineClose onclick={close} size="1.25em" class="cursor-pointer" />

</div>
<div class="mt-2">{children()}</div>
</div>
</div>
)
})
return { close };
}
7 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
I changed it to renderStream, it does fix the timeout but the error boundary still wont catch the error
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
In the entry-server?
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
In what
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
export async function gqlCall(query: string) {
const queryFinale = JSON.stringify({ query });

const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
body: queryFinale,
});

if (!response.ok) return;
const gqlResponse = await response.json();
if (gqlResponse.errors) return;
return gqlResponse.data;
}
export async function gqlCall(query: string) {
const queryFinale = JSON.stringify({ query });

const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
body: queryFinale,
});

if (!response.ok) return;
const gqlResponse = await response.json();
if (gqlResponse.errors) return;
return gqlResponse.data;
}
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
export async function fetchServiceInfoDetailed(
service_name: string
): Promise<IActionServiceInfoDetailed> {
const result = await gqlCall(
`....`
);

if (result?.service) return result?.service;

throw new Error("Failed to fetch service information.");
}
export async function fetchServiceInfoDetailed(
service_name: string
): Promise<IActionServiceInfoDetailed> {
const result = await gqlCall(
`....`
);

if (result?.service) return result?.service;

throw new Error("Failed to fetch service information.");
}
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
import { For, createEffect } from "solid-js";
import { createRouteData, useParams, useRouteData } from "solid-start";

import { fetchServiceInfoDetailed } from "~/lib/actions/service";

export function routeData() {
const params = useParams<{ id: string }>();

return createRouteData(() => fetchServiceInfoDetailed(decodeURI(params.id)));
}

export default function ServiceDetail() {
const serviceInfo = useRouteData<typeof routeData>();
createEffect(() => {
console.log(serviceInfo());
});
return (
<>
<div>
{serviceInfo()
?.description.split("\n")
.map((str) => (
<>
<p>{str}</p>
<br />
</>
))}
<ul class="mt-10 list-disc list-inside">
<For each={serviceInfo()?.benefit}>
{(featureish) => (
<li class="mt-2">
<span>{featureish}</span>
</li>
)}
</For>
</ul>
</div>
</>
);
}
import { For, createEffect } from "solid-js";
import { createRouteData, useParams, useRouteData } from "solid-start";

import { fetchServiceInfoDetailed } from "~/lib/actions/service";

export function routeData() {
const params = useParams<{ id: string }>();

return createRouteData(() => fetchServiceInfoDetailed(decodeURI(params.id)));
}

export default function ServiceDetail() {
const serviceInfo = useRouteData<typeof routeData>();
createEffect(() => {
console.log(serviceInfo());
});
return (
<>
<div>
{serviceInfo()
?.description.split("\n")
.map((str) => (
<>
<p>{str}</p>
<br />
</>
))}
<ul class="mt-10 list-disc list-inside">
<For each={serviceInfo()?.benefit}>
{(featureish) => (
<li class="mt-2">
<span>{featureish}</span>
</li>
)}
</For>
</ul>
</div>
</>
);
}
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
aight i simplify it
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
No png would ruin the code the code is too long
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
Im stuck
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
Help plss its the last error that i need to solve im this is just a personal project ill upload it in github if more detail is needed
18 replies
SSolidJS
Created by febri on 10/29/2023 in #support
Error boundary wont catch error
am i missing something? in the terminal the error is being logged but error boundary wont show the fallback component
18 replies