Pridgey
Pridgey
SSolidJS
Created by Pridgey on 2/21/2025 in #support
Another `template2 is not a function` issue
No description
5 replies
SSolidJS
Created by Pridgey on 3/24/2023 in #support
using readFile in routeData
I have a directory /src/data with markdown files. I'd like to readFile a markdown file from that directory during createRouteData, but it can't seem to find the file. Is this possible?
2 replies
SSolidJS
Created by Pridgey on 1/22/2023 in #support
Using FLIP Move with createServerData
I'm building a page that displays ranked results users can vote on. I pull the data from the routeData using createServerData. From there, I listen to a websocket to know when another user has made a change, and then refetch the routeData using refetchRouteData(). I feed the results of the route data into a different component that displays the results in order of rank. In this Results component I wrap the list in a <TransitionGroup> component from solid-flip. This animates nicely when new records are added and removed, but doesn't animate them nicely if they are rearranged. Instead I just get a sudden re-rendering of the results. I'm hoping to understand why the reordering animation doesn't work. I'm not sure if it's an issue with how I have it setup, or if it is a result of the data coming from createServerData. Any insight would be very helpful. Thank you very much
7 replies
SSolidJS
Created by Pridgey on 1/15/2023 in #support
Subscribe to data in solid-start
I'm using Supabase with solid-start. I'm pulling data from the postgres db using createServerData$ function. I'm hoping to have this page subscribe to the data and update if another user inserts data to the postgres table. Are there any patterns to handle this using solid-start? I'm not sure how to subscribe in an SSR setting.
8 replies
SSolidJS
Created by Pridgey on 12/14/2022 in #support
How to make a global layout?
I'd like to make a single layout for all of my pages within the route structure, but I'm not quite sure how to do this. If I make a routes/(root).tsx file, then the / path shows up as that html & css, but nothing from routes/index.tsx populates the <Outlet />. And if I navigate to /login then the html & css from the layout doesn't appear at all. So I'm not sure what it should be instead.
5 replies
SSolidJS
Created by Pridgey on 12/8/2022 in #support
Getting User Info from route page
I might be fundamentally misunderstanding how this is supposed to work, so if that is the case please let me know. I'm authenticating with Supabase via the /signin route, which stores the jwt in a cookie. Now, when I load up index.tsx I'm hoping to get the User data to render on the page. Something simple like a "Hello {Username}". Here is what my index.tsx looks like:
import { Component } from "solid-js";
import { createServerData$ } from "solid-start/server";
import Header from "~/components/Header";
import { getUser } from "~/lib/session";
import { useRouteData } from "solid-start";

export function routeData() {
return createServerData$(async (_, event) => {
const user = await getUser(event.request);
console.log("Index.tsx", user);
return {
user: "",
};
});
}

const Home: Component = () => {
const user = useRouteData<any>();

console.log("Render:", user);

return (
<div class="mt-20 w-full max-w-lg mx-auto">
<Header />
</div>
);
};

export default Home;
import { Component } from "solid-js";
import { createServerData$ } from "solid-start/server";
import Header from "~/components/Header";
import { getUser } from "~/lib/session";
import { useRouteData } from "solid-start";

export function routeData() {
return createServerData$(async (_, event) => {
const user = await getUser(event.request);
console.log("Index.tsx", user);
return {
user: "",
};
});
}

const Home: Component = () => {
const user = useRouteData<any>();

console.log("Render:", user);

return (
<div class="mt-20 w-full max-w-lg mx-auto">
<Header />
</div>
);
};

export default Home;
getUser() works as expected and retrieves the user's information. The console.log in routeData() displays user data. Hooray. How do I get that same data into the component? useRouteData doesn't seem to have it, and the console.log("Render:"... seems to be happening well before the routeData() function has finished. This is where I think there's a gap in my understanding of how this works. So any insight would be incredible. Thank you all,
28 replies