Xzayler
Explore posts from serversRedirect troubles
I could not recreate this in stackblitz, weirdly enough, but for me this works: But this doesn't:
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
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
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
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
Navigating with A from and to dynamic route doesn't re-render.
Basically, the pattern
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
Navigating with A from and to dynamic route doesn't re-render.
Yes, this is working well so far.
https://stackblitz.com/edit/github-qx1qqd?file=src%2Froutes%2Fpost%2F%5Bpostid%5D.tsx
46 replies