Fabian Hiller
Fabian Hiller
Explore posts from servers
SSolidJS
Created by akerbeltz on 7/25/2023 in #support
Validating a field based on promise values min and max with yup and react form handler
I can't help you with that. But maybe my project Modular Forms and Valibot offers you an alternative way with SolidJS. Modular Forms: https://modularforms.dev/ Valibot: https://valibot.dev/
3 replies
SSolidJS
Created by binajmen on 7/12/2023 in #support
How to handle complex form?
Maybe my modular and type safe form library can help: https://modularforms.dev/
10 replies
SSolidJS
Created by avant on 5/25/2023 in #support
Does SolidStart have CSRF protection by default?
I don't think it always needs a cookie banner. As far as I know, cookies without which the website does not work (e.g. auth cookies) can be set.
24 replies
SSolidJS
Created by avant on 5/25/2023 in #support
Does SolidStart have CSRF protection by default?
Can't this be prevented with the SameSite cookie attribute?
24 replies
SSolidJS
Created by Fabian Hiller on 2/17/2023 in #support
Is it possible to create a `createCustomAction$`?
@nksaraf is there any news on this?
10 replies
SSolidJS
Created by Fabian Hiller on 2/17/2023 in #support
Is it possible to create a `createCustomAction$`?
By when do you plan to provide the API for this? Depending on that, I would rather wait.
10 replies
SSolidJS
Created by Fabian Hiller on 2/17/2023 in #support
Is it possible to create a `createCustomAction$`?
I understand. That means it's not possible at the moment, right?
10 replies
SSolidJS
Created by avant on 12/1/2022 in #support
Handling forms
How do you access e.g. error messages and display them in the form? Via URL search parameters?
12 replies
SSolidJS
Created by avant on 12/1/2022 in #support
Handling forms
I'm using a <textarea> element with Modular Forms in a project. Since the functionality is very similar to <input>, it should work. Let me know if you run into a problem.
12 replies
SSolidJS
Created by avant on 12/1/2022 in #support
Handling forms
Modular Forms is another option: https://modularforms.dev/
12 replies
SSolidJS
Created by Fabian Hiller on 12/27/2022 in #support
How to set a cookie when using `createRouteData` or `createServerData$`?
Thanks for linking @colinshen!
14 replies
SSolidJS
Created by Fabian Hiller on 12/27/2022 in #support
How to set a cookie when using `createRouteData` or `createServerData$`?
@nksaraf what are your thoughts on this? If you're interested, I can take a look at the code on GitHub and create a PR. Cookies are not uncommon in data fetching, so I expect more people will run into this "problem" in the future.
14 replies
SSolidJS
Created by Fabian Hiller on 12/27/2022 in #support
How to set a cookie when using `createRouteData` or `createServerData$`?
Is it possible to implement createRouteData and createServerData similar to Remix, so that it makes no difference whether you return the values directly or via a Response, e.g. with json() ? Otherwise unpacking the data in the component leads to a lot of boilerplate code. Especially with createRouteData this would make the code more consistent and lead to a better DX.
14 replies
SSolidJS
Created by Fabian Hiller on 12/27/2022 in #support
How to set a cookie when using `createRouteData` or `createServerData$`?
@nksaraf thanks for your answer! Is it meant as in the following code example?
import { createResource } from 'solid-js';
import { json, useRouteData } from 'solid-start';
import { createServerData$ } from 'solid-start/server';
import { getCurrentUser } from '../api';

export function routeData() {
return {
getUser: createServerData$((_, event) => {
const user = getCurrentUser(event.request);
return json(user.data, { headers: { 'Set-Cookie': user.cookie } });
}),
};
}

export default function HomePage() {
const { getUser } = useRouteData<typeof routeData>();
const [data] = createResource(getUser, (user) => user.json());
return <h1>{data.username}</h1>;
}
import { createResource } from 'solid-js';
import { json, useRouteData } from 'solid-start';
import { createServerData$ } from 'solid-start/server';
import { getCurrentUser } from '../api';

export function routeData() {
return {
getUser: createServerData$((_, event) => {
const user = getCurrentUser(event.request);
return json(user.data, { headers: { 'Set-Cookie': user.cookie } });
}),
};
}

export default function HomePage() {
const { getUser } = useRouteData<typeof routeData>();
const [data] = createResource(getUser, (user) => user.json());
return <h1>{data.username}</h1>;
}
14 replies
SSolidJS
Created by Fabian Hiller on 12/27/2022 in #support
How to set a cookie when using `createRouteData` or `createServerData$`?
This way the returned value of useRouteData is a Response and I cannot use the data in the component as it works in Remix. Maybe @nksaraf knows the answer.
14 replies
SSolidJS
Created by Fabian Hiller on 12/13/2022 in #support
Refetch routeData when dynamic route changes
Ok, I think figured out how it works. I have changed the key to a function with an array.
export function routeData({ params }: RouteDataArgs) {
return {
post: createRouteData(
(key) => fetch(key),
{ key: () => ['post', params.slug] }
),
};
}
export function routeData({ params }: RouteDataArgs) {
return {
post: createRouteData(
(key) => fetch(key),
{ key: () => ['post', params.slug] }
),
};
}
2 replies