ChrisThornham
ChrisThornham
SSolidJS
Created by ChrisThornham on 7/1/2024 in #support
Is My Understanding Of RouteSectionProps Correct?
Thanks! Those are some great points.
10 replies
SSolidJS
Created by ChrisThornham on 7/1/2024 in #support
Is My Understanding Of RouteSectionProps Correct?
That was a big mental model for me to understand. I finally get it.
10 replies
SSolidJS
Created by ChrisThornham on 7/1/2024 in #support
Is My Understanding Of RouteSectionProps Correct?
Thank you.
10 replies
SSolidJS
Created by ChrisThornham on 7/1/2024 in #support
Is My Understanding Of RouteSectionProps Correct?
You're right. The values are the same, but I don't think the load function knows anything about the route params when using useParams. For example, in the example below, getUser inside of createAsync gets the correct value. But I don't think the load function has access to that value. Am I right?
export const route = {
load() {
void getUser(what would go here?);
},
};

export default function UserDetailsPage() {
const params = useParams();
const user = createAsync(() => getUser(params.email));
export const route = {
load() {
void getUser(what would go here?);
},
};

export default function UserDetailsPage() {
const params = useParams();
const user = createAsync(() => getUser(params.email));
10 replies
SSolidJS
Created by ChrisThornham on 6/30/2024 in #support
Help Me Solve "undefined" warning When Using <Show> Component
That worked like a charm! Thank you! You just solved a big headache. I'll be adding this to my notes. Have a great night.
3 replies
SSolidJS
Created by ChrisThornham on 6/13/2024 in #support
What Replaced createRouteData?
Thanks, @peerreynders I tried that pattern, but createAsync didn't like what Vite returned. I ended up with this pattern that works well. I still have to work on the one any I have in there 🙂
export default function BlogHomePage() {
// DATA =============================================================
// Use vite to get all mdx files in the articles folder
const files = import.meta.glob("./articles/*.mdx");

interface BlogMetaData {
url: string;
title: string;
description: string;
author: string;
date: string;
}

// STATE ============================================================
const [articles, setArticles] = createStore<BlogMetaData[]>([]);

for (const file in files) {
files[file]().then((metaData: any) => {
const articleData: BlogMetaData = {
url: file.replace("./", "/blog/").replace(".mdx", ""),
title: metaData.title,
description: metaData.description,
author: metaData.author,
date: metaData.date,
};
// Sort articles by date.
setArticles((prevArticles) => {
const newArticles = [...prevArticles, articleData];
newArticles.sort(
(a, b) => parseDate(b.date).getTime() - parseDate(a.date).getTime()
);
return newArticles;
});
});
}

// FUNCTIONS ========================================================
function parseDate(dateString: string) {
return new Date(dateString);
}

return (
// render articles here...
)
}
export default function BlogHomePage() {
// DATA =============================================================
// Use vite to get all mdx files in the articles folder
const files = import.meta.glob("./articles/*.mdx");

interface BlogMetaData {
url: string;
title: string;
description: string;
author: string;
date: string;
}

// STATE ============================================================
const [articles, setArticles] = createStore<BlogMetaData[]>([]);

for (const file in files) {
files[file]().then((metaData: any) => {
const articleData: BlogMetaData = {
url: file.replace("./", "/blog/").replace(".mdx", ""),
title: metaData.title,
description: metaData.description,
author: metaData.author,
date: metaData.date,
};
// Sort articles by date.
setArticles((prevArticles) => {
const newArticles = [...prevArticles, articleData];
newArticles.sort(
(a, b) => parseDate(b.date).getTime() - parseDate(a.date).getTime()
);
return newArticles;
});
});
}

// FUNCTIONS ========================================================
function parseDate(dateString: string) {
return new Date(dateString);
}

return (
// render articles here...
)
}
5 replies
SSolidJS
Created by ChrisThornham on 6/13/2024 in #support
What Replaced createRouteData?
Thanks. I'll experiment with that.
5 replies
SSolidJS
Created by ChrisThornham on 6/5/2024 in #support
Is It Possible To Pass An Extra Parameter To A Form Action?
Thanks! I'll give that a try.
5 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Thanks again!
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Stripe works great, but their docs are very dense. It's easy to miss things.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Oh!!! I was thinking destroy was from solid. Duh Great. Can't thank you enough. I was fighting this for a couple of hours.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
That works. Where did you get destroy from? A quick search in the docs and I don't see it mentioned.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
You're a genius!
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
That's at least how the docs suggest to do it: https://docs.solidjs.com/concepts/refs#refs
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
let checkoutElement: HTMLDivElement;
let checkoutElement: HTMLDivElement;
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Seems like a problem @peerreynders could solve in his sleep. Haha.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Haha
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
Unfortunately, no. Same error.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
I'm not sure. I've got to run for a bit. I'll keep plugging away at this and see if anyone else chimes in with some ideas.
30 replies
SSolidJS
Created by ChrisThornham on 5/21/2024 in #support
Trouble With onCleanup()
The check for the existence of checkoutElement also fails on the second load:
if (checkoutElement) {
checkout?.mount(checkoutElement);
}
if (checkoutElement) {
checkout?.mount(checkoutElement);
}
30 replies