jacobgoodwin
jacobgoodwin
SSolidJS
Created by jacobgoodwin on 4/10/2024 in #support
Possible to map of `useSubmissions` result?
This does work! Thanks. I guess this is a way to access the inner array of the proxy, then. This is one I'll definitely want to catelog in the old noggin'
5 replies
SSolidJS
Created by jacobgoodwin on 4/10/2024 in #support
Possible to map of `useSubmissions` result?
Thanks. It will be useful for me to look into the internals to better understand solid-js.
5 replies
SSolidJS
Created by jacobgoodwin on 2/27/2024 in #support
Is there any approach to invalidate the back/forward browser cache in solid-router (v 0.12.x)?
This was answered in solid-router discussions as is considered a bug. I'll chill the hell out. 🙂
3 replies
SSolidJS
Created by jacobgoodwin on 2/27/2024 in #support
Is there any approach to invalidate the back/forward browser cache in solid-router (v 0.12.x)?
I'll note that a much easier example is solid-start's own with-auth example, where you can log out, and the click the browser back button to show the page. I've tried some some cache header controls and some client-side workarounds. I had no luck with the former, and the latter will always show the page momentarily before reloading the page.
3 replies
SSolidJS
Created by Raqueebuddin Aziz on 2/28/2024 in #support
is it possible to use matchFilters from @solidjs/router in file routes?
I'm not sure if this is the preferred approach, but you do have access to the params in the load function. So you might be able to do something like below, where I wrapped the validateFileId in a cache because I believe this is the only way to properly handle either returning a redirect. I've become used to using throw redirect, but I was having issues with this and I'm not sure why, but returning a redirect seems to work (maybe a recent API change, as I just created a fresh solid-start repo, and it's now v 0.6.0, as of today).
The good news is the blow seems to work with solid-start with bother CSR and SSR.
import { RouteDefinition, RouteSectionProps, cache, redirect } from "@solidjs/router";

const validateFileId = cache((fileId: string) => {
const id = Number(fileId);
console.debug('In the loader function', { id });
if (id > 10) {
console.warn('Whoopsies, this is OUTTABOUNDS, you ignoramous!');
return redirect('/error-page-or-route', { status: 404 });
}

// some API data here
return {
data: 'abc123',
};
}, 'file')

export const route = {
load: (args) => {
console.debug('the route args', args);
validateFileId(args.params.id);
}
} satisfies RouteDefinition;

export default function FilePage(props: RouteSectionProps) {

return (
<h1>This page has param id: {props.params.id}</h1>
)
}
import { RouteDefinition, RouteSectionProps, cache, redirect } from "@solidjs/router";

const validateFileId = cache((fileId: string) => {
const id = Number(fileId);
console.debug('In the loader function', { id });
if (id > 10) {
console.warn('Whoopsies, this is OUTTABOUNDS, you ignoramous!');
return redirect('/error-page-or-route', { status: 404 });
}

// some API data here
return {
data: 'abc123',
};
}, 'file')

export const route = {
load: (args) => {
console.debug('the route args', args);
validateFileId(args.params.id);
}
} satisfies RouteDefinition;

export default function FilePage(props: RouteSectionProps) {

return (
<h1>This page has param id: {props.params.id}</h1>
)
}
6 replies