Xzayler
Xzayler
Explore posts from servers
SSolidJS
Created by Xzayler on 8/3/2024 in #support
Deploying solidstart problems
Ok yeah it, simply adding the preset worked perfectly. Thanks a bunch!
5 replies
SSolidJS
Created by Xzayler on 8/3/2024 in #support
Deploying solidstart problems
This seems to have fixed the vercel deployment issue, but can't confirm 100% yet.
5 replies
SSolidJS
Created by Xzayler on 7/6/2024 in #support
Mutating a resource
that is, in fact, exactly what I did. This shows how I still don't really have even the js fundamentals completely down. Thanks for clearing that up, it's working as intended now!
4 replies
SSolidJS
Created by Xzayler on 6/25/2024 in #support
Redirect troubles
Oh I see. Thanks for the help and clearing that up for me!
9 replies
SSolidJS
Created by Xzayler on 6/25/2024 in #support
Redirect troubles
I could not recreate this in stackblitz, weirdly enough, but for me this works:
// lib/gcu.ts
export const getCurrentUser = cache(async (): Promise<User> => {
"use server";
...
throw redirect("/login");
...
}
// lib/gcu.ts
export const getCurrentUser = cache(async (): Promise<User> => {
"use server";
...
throw redirect("/login");
...
}
But this doesn't:
// lib/gcu.ts
"use server";
export const getCurrentUser = cache(async (): Promise<User> => {
...
throw redirect("/login");
...
}
// lib/gcu.ts
"use server";
export const getCurrentUser = cache(async (): Promise<User> => {
...
throw redirect("/login");
...
}
Is there a reason for this? Now everything seems to work fine by just putting the function in a separate file without a file-wide "use server; and sticking it in the function instaed.
9 replies
SSolidJS
Created by Xzayler on 6/25/2024 in #support
Redirect troubles
Ok I managed to get closer to figuring out the issue. Basically if I have the function that throws the redirect in a file that has a "use server"; line at the top, it won't work.
9 replies
SSolidJS
Created by Xzayler on 6/25/2024 in #support
Redirect troubles
Well so far I think the reason I didn't have the undefined issue is that everything was in a Suspense component and I ran the getCurrentUser function in a createResource(). It definitely worked before but an old update may have broken it without me realising. Could have happened anytime between now and 3 months ago I think. I now included a <Show when={user()} fallback={<div>Loading...</div>}> component to avoid getting the undefined properties error, but it hangs forever on the fallback. Basically the getCurrentUser function does seem to throw but then nothing happens...
9 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
Right! Yes I am in fact using resource. Sorry for being dumb and thanks for the help.
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
Why does that happen though? Tbf I don't understand and I just noticed everything under the closest suspense boundary was rerendering
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
NVM I solved it by simply wrapping the Show in a Suspense It's exactly what I did, and I just tried that again and had a Show when={active()} where active is a bool signal accessor and there was the component I wanted wrapped in this Show component, but every time I hover over the element, the whole page goes black for a split second and then the tooltip shows. However when the page goes black it also counts as a MouseLeave event and so the active signal is set to false which causes another flicker, and since my mouse is still above the hoverable element the whole loop starts from the beginning. Basically every time the when changes everything goes black for a little bit.
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
My biggest issue now is that creating components and then mounting them can leave them undestroyed and stuck in memory. ANd that's how all my modals, tooltips currently work...
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
Oh good idea. Thanks!
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
And final reason is I guess I just want to learn how to create ephemeral components.
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
Yeah I copied the code wrong in my reply. It's setting it right in my code except the data fetching or anything reactive doesn't seem to work in the created component. My goal is for the element to be created only on hover, and then be destroyed when the mouse leaves the hovered element. Other options would be: - Having one tooltip component created on page load, whose position and displayed data is changed. I could do this I guess but I'd have to implement refetching and calculating positions and stuff and it seems a little excessive, there's definitely a better way. - Creating a separate tooltip component for each wrapper and then just using Show to hide them. I tried this and it resulted in a lot of flickering every time I hovered. There are a lot of these wrappers present on the page at one time, and I also want them to refetch data when re-hovered.
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
The issue seems to be me using useAction outside of any context, but idk how I could implement this tooltip functionality without creating components on the fly.
22 replies
SSolidJS
Created by Xzayler on 4/15/2024 in #support
Dynamically rendering components
I tried doing that like so:
const activate = (handle: string) => {
setElement(() => {
<Portal mount={tooltipbox as HTMLElement}>
<UserPopup userHandle={handle} />
</Portal>
});
};
const activate = (handle: string) => {
setElement(() => {
<Portal mount={tooltipbox as HTMLElement}>
<UserPopup userHandle={handle} />
</Portal>
});
};
And the result I see is exactly the same as without portal
22 replies
SSolidJS
Created by Xzayler on 3/28/2024 in #support
Navigating with A from and to dynamic route doesn't re-render.
Basically, the pattern
const params = useParams();
const [post] = createResource(
() => params.updatingVal, // source
(val) => { // fetchData
return fetchData(val);
}
);
const params = useParams();
const [post] = createResource(
() => params.updatingVal, // source
(val) => { // fetchData
return fetchData(val);
}
);
Basically source (first arg of createResource) should be a function returning the value that's changing. If solid detects that that value changed, it will run the fetchData fetcher function passed to it as the second arg and will also pass to it the up-to-date value of the source as an argument. What I was doing wrong was passing a straight up value to the source arg.
46 replies
SSolidJS
Created by Xzayler on 3/28/2024 in #support
Navigating with A from and to dynamic route doesn't re-render.
46 replies
SSolidJS
Created by Xzayler on 3/28/2024 in #support
Navigating with A from and to dynamic route doesn't re-render.
Well thanks for the help I feel like this is gonna be very good to know in the future
46 replies
SSolidJS
Created by Xzayler on 3/28/2024 in #support
Navigating with A from and to dynamic route doesn't re-render.
exactly
46 replies