Hussein
Hussein
Explore posts from servers
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
but i remember i used it in dev, maybe i'm just confused
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
probably because waitUntil is only defined in nitro which is not used by solidstart in dev
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
but i have a new problem, event.nativeEvent.waitUntil became undefined (in dev only) all of a sudden
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
yeah its definitely a start issue
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
i fixed it for now by changing my code to this
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
import { APIEvent } from "@solidjs/start/server";

export function GET(event: APIEvent) {
event.nativeEvent.waitUntil(send());

return Response.json("Optimistically sent a message!");
}

async function send() {
await fetch(`https://discord.com/api/v10/channels/CHANNEL/messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bot TOKEN`,
},
body: JSON.stringify({
content: "",
}),
});
}
import { APIEvent } from "@solidjs/start/server";

export function GET(event: APIEvent) {
event.nativeEvent.waitUntil(send());

return Response.json("Optimistically sent a message!");
}

async function send() {
await fetch(`https://discord.com/api/v10/channels/CHANNEL/messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bot TOKEN`,
},
body: JSON.stringify({
content: "",
}),
});
}
9 replies
SSolidJS
Created by Hussein on 2/14/2025 in #support
ERR_HTTP_HEADERS_SENT
i tested with plain h3 and it worked fine
9 replies
SSolidJS
Created by avant on 5/25/2023 in #support
Does SolidStart have CSRF protection by default?
questionmark Didnt find it in docs, so I'm just asking to be sure
25 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
interesting
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
i will try this
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
if you mean perf by optimization, no. i just think its more correct to have this sense of pages and the loaders run before the pages
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
i don't care what is the way, i just want any way at all to not run the component at all if it redirects
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
@Brendonovich 😢
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
import { render } from "solid-js/web";
import { Router, Route, useNavigate } from "@solidjs/router";

function Home() {
console.log("ran");

return <h1>Home</h1>;
}

function App() {
return (
<Router>
<Route
preload={() => useNavigate()("/other")}
path="/"
component={Home}
/>
<Route path="/other" component={Other} />
</Router>
);
}

function Other() {
return (
<>
<h1>Other</h1>
<a href="/">Home</a>
</>
);
}

render(() => <App />, document.getElementById("app"));
import { render } from "solid-js/web";
import { Router, Route, useNavigate } from "@solidjs/router";

function Home() {
console.log("ran");

return <h1>Home</h1>;
}

function App() {
return (
<Router>
<Route
preload={() => useNavigate()("/other")}
path="/"
component={Home}
/>
<Route path="/other" component={Other} />
</Router>
);
}

function Other() {
return (
<>
<h1>Other</h1>
<a href="/">Home</a>
</>
);
}

render(() => <App />, document.getElementById("app"));
run this and then click on the link in the /other page. console.log("ran"); will trigger when clicking the <a>. is there a way to not run the component at all?
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
Uncaught Error: <A> and 'use' router primitives can be only used inside a Route.
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
function App() {
const redirect = useNavigate();
return (
<Router>
<Route preload={() => redirect("/other")} path="/" component={Home} />
<Route path="/other" component={Other} />
</Router>
);
}
function App() {
const redirect = useNavigate();
return (
<Router>
<Route preload={() => redirect("/other")} path="/" component={Home} />
<Route path="/other" component={Other} />
</Router>
);
}
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
like this? it doesn't work
24 replies
SSolidJS
Created by Hussein on 10/17/2024 in #support
is there a way to start data fetching before component rendering?
import { render } from "solid-js/web";
import { Router, Route } from "@solidjs/router";

function Home() {
return <h1>Home</h1>;
}

function App() {
return (
<Router>
<Route
preload={() => Response.redirect("/other")}
path="/"
component={Home}
/>
<Route path="/other" component={Other} />
</Router>
);
}

function Other() {
return <h1>Other</h1>;
}

render(() => <App />, document.getElementById("app"));
import { render } from "solid-js/web";
import { Router, Route } from "@solidjs/router";

function Home() {
return <h1>Home</h1>;
}

function App() {
return (
<Router>
<Route
preload={() => Response.redirect("/other")}
path="/"
component={Home}
/>
<Route path="/other" component={Other} />
</Router>
);
}

function Other() {
return <h1>Other</h1>;
}

render(() => <App />, document.getElementById("app"));
24 replies
SSolidJS
Created by Spaghetto on 10/8/2024 in #support
Can't make Router Work
are you on "/" in your browser?
14 replies
SSolidJS
Created by Spaghetto on 10/8/2024 in #support
Can't make Router Work
that code looks like it should work
14 replies