James
James
SSolidJS
Created by James on 6/28/2024 in #support
@solidjs/start @solidjs/meta not being SSR'd when resources used, bug or my misuse?
legend!! thank you @peerreynders <3
4 replies
SSolidJS
Created by James on 6/28/2024 in #support
@solidjs/start @solidjs/meta not being SSR'd when resources used, bug or my misuse?
Actually it appears to render the title in SSR for the first page load after the server starts, but not subsequent requests, so I'm guessing bug... next question, how can I work around this? 😅
4 replies
SSolidJS
Created by James on 9/18/2023 in #support
React key prop substitute!
oh right! strange syntax but I guess it makes sense, thank you!
6 replies
SSolidJS
Created by James on 9/18/2023 in #support
React key prop substitute!
whereas in React you can use key={whateverPrimitiveYouWant} to re-render a component, the reason I'm trying to do this is to recreate a bunch of components in my root.tsx (solid-start) for a page on router change - but I think I'll use a layout function and put that in each of the pages instead
6 replies
SSolidJS
Created by James on 9/18/2023 in #support
React key prop substitute!
it's not that I need to be able to toggle a component on/off - I need it to, on a single update be totally replaced by a new instance I can achieve that using a signal along the lines of:
const [shouldMount, setShouldMount] = useSignal(false);

function remount() {
setShouldMount(false);
setTimeout(() => {
setShouldMount(true);
});
}

return signal() && (
<Component />
);
const [shouldMount, setShouldMount] = useSignal(false);

function remount() {
setShouldMount(false);
setTimeout(() => {
setShouldMount(true);
});
}

return signal() && (
<Component />
);
but that causes the DOM to be totally removed for a split second
6 replies
SSolidJS
Created by James on 3/15/2023 in #support
Get SSR attribute value when hydrating
function retrieveSsrClass() {
const el = document.querySelector(`*[data-hk^="${sharedConfig.context?.id}"]`) as HTMLElement;
if (el == null) {
return null;
}

return el.getAttribute('class');
}
function retrieveSsrClass() {
const el = document.querySelector(`*[data-hk^="${sharedConfig.context?.id}"]`) as HTMLElement;
if (el == null) {
return null;
}

return el.getAttribute('class');
}
this is what I ended up doing, seems to work, don't know if it will work for every scenario aha and I'm sure there's a more efficient way of accessing the element, if anyone has any better ideas lmk! - thanks for your help @thetarnav!
10 replies
SSolidJS
Created by James on 3/15/2023 in #support
Get SSR attribute value when hydrating
hey @thetarnav thanks for sending this! helpful little library that - although this'll work, I'm wondering if I could somehow just read the element's attribute since that's already in the document anyway and looking at that library's source, it seems to create a script tag with the data duplicated to get it to the client - for this specific use case, accessing the element to-be-hydrated would be ideal!
10 replies