ry
ry
Explore posts from servers
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
Yeah I see where you are coming from, totally agree that many sites have gone too far with loaders. But take youtube for example, navigating to a new video has similar transition hold for the main data with a page loader, but it no longer holds waiting for comments to load. I think waiting for secondary data to load before showing a page is worse.
12 replies
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
I still think having component level fallbacks make sense in some cases like the one I show, with multiple resources where 1 is slow, relying only on a page level indicater seems like bad ux. Similar to how you can add deferStream to indicate which resources need to load before flushing the page.
12 replies
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
I landed on a similar solution by dimming the page and a loader in the navbar in my app to indicate this to the user. I guess useTransition would be more correct
12 replies
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
That workaround in the issue does seem like a viable escape hatch that makes sense since you exclude the resource from the navigation transition. Although it might not be obvious to figure out. Might just need some more documentation around it. I believe createAsync is just a higher-level wrapper around createResource so the transitions work the same.
// Navigation no longer waits for resource
<Show when={!isRouting()}>
<Suspense fallback={<div>...</div>}>
<div>{fdata()}</div>
</Suspense>
</Show>
// Navigation no longer waits for resource
<Show when={!isRouting()}>
<Suspense fallback={<div>...</div>}>
<div>{fdata()}</div>
</Suspense>
</Show>
I experience the same behavior you describe for the effect param value holding. To me this seems intentional? Since you want to hold the same state during the transition.
12 replies
SSolidJS
Created by ry on 4/6/2024 in #support
Resource loading from param blocks navigation
Thanks for this. Yeah basically I want to opt out of the transitions because if the page has multiple resources, I don't want 1 slow resource to pause the navigation. Would you say this is a bug that createResource does this? https://stackblitz.com/edit/github-xdufjx-uf411k?file=src%2FAPI.ts
12 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
Thanks for sharing. I have pages that have dates on first load, so I opted to render as UTC and update on client.
const LocaleDate: Component<Props> = (props) => {
const [display, setDisplay] = createSignal<string>(
formatDate(props.date, {
timeZone: "Etc/UTC",
}) + " (UTC)"
);

createEffect(() => {
setDisplay(formatDate(props.date));
});

return <time datetime={props.date.toISOString()}>{display()}</time>;
};
const LocaleDate: Component<Props> = (props) => {
const [display, setDisplay] = createSignal<string>(
formatDate(props.date, {
timeZone: "Etc/UTC",
}) + " (UTC)"
);

createEffect(() => {
setDisplay(formatDate(props.date));
});

return <time datetime={props.date.toISOString()}>{display()}</time>;
};
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
Came across this as well, would be so much better if there was a html element to do this
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
Yeah I'm leaning towards 2) was wondering if anyone else has a good pattern for implementing this
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
The concern for me is displaying the date in the user's timezone
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
Thanks will take a look at that article
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
I'm thinking if there's an easy to only render/rerender the dates on client
18 replies
SSolidJS
Created by ry on 1/27/2023 in #support
Handling locale dates when SSR
You mean by passing the locale in the url right?
18 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
Is my understanding correct that nft alone would not be sufficient as it doesn't include schema.prisma ?
90 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
I think you would have to copy the files to both, as the api.func is simply a duplicate of the render.func with a route configuration that points api routes to it
90 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
Opened a PR here for Vercel and Netlify https://github.com/solidjs/solid-start/pull/644
90 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
Do you think having an adapter config would be better? Since we would not have unnecessary duplicate files in .solid
solid({
adapter: netlify({
include: ["node_modules/prisma/*engine*.node", "prisma/schema.prisma"]
})
})
solid({
adapter: netlify({
include: ["node_modules/prisma/*engine*.node", "prisma/schema.prisma"]
})
})
But it would have to flatten the directory, not sure if there is a usecase where the directory structure needs to be preserved (prisma/schema.prisma -> render.func/schema.prisma)
90 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
Yeah confirmed the schema is required on Netlify deployment as well
90 replies
SSolidJS
Created by Razboy20 on 1/13/2023 in #support
Vercel + Prisma
Is copying the prisma schema something that needs to happen on non-vercel deployments as well? Would it make sense to copy the schema into .solid/server for a more adapter agnostic approach, and have adapters copy all additional files?
90 replies