Luka
Suspense and dealing with large data
When I am using deferStream true it doesnt show the suspense fallbacks but as soon as I set it to false the fallbacks work well. Is it because of deferStream that suspenses dont work in my case?
deferStream should be waiting for all the data until rendering the suspense so it kind of skips it I guess correct me if I am wrong.
But if this is the case how can I have loading with the deferStream: true? I want to keep deferstream because of SSR.
I might be completely wrong about how these work I am new to SSR and solid as well )
So here is how I fetch the data now I changed it to multiple request so I could use multiple suspenses I guess
const user = createAsync(async () => {
const [userData, userSkills] = await Promise.all([
get_xelosani(props.params.id),
get_skills(props.params.id)
]);
return { userData, userSkills };
}, { deferStream: true });
I kind of pass down data to another component like this
<ProfileRight
user={user}
setEditingServiceTarget={setEditingServiceTarget}
setModal={setModal}
/>
<Suspense
fallback={
<p>Loading...</p>
}
>
<p class="text-xs font-[thin-font] font-bold">
შემოუერთდა {props.user()?.userData?.creationDateDisplayable}
</p>
</Suspense>
<section class="w-full flex">
<Suspense fallback={<div>
Loading...
</div>}>
<SkillCarousel skills={props.user()?.userSkills?.skills}></SkillCarousel>
</Suspense>
</section>
5 replies
Server Side Rendering
const user = createAsync(() => get_xelosani(props.params.id), {deferStream: true})
adding deferstream works so for now how I understand the ssr in solid/solidstart is when user comes to the page createAsync makes request to the server then gathers everything it needs then it inserts these data based on jsx that we have and the it hydrates it. Is this correct flow of how it works? also does createAsync run on server? for now I think it should be running on server right?
4 replies
Sevoral Error while using AbortController
I modifed the code a bit it was aborting instantly not even sending to server function here is updated code I have same sevoral error
const handleFilePreview = async (file) => {
setImageLoading(true)
const abortController = new AbortController();
console.log(file)
if (imageLoading() && !file) {
abortController.abort()
}
console.log(abortController.signal)
try {
const response = await preview_image(file, props.user().profId, {
signal: abortController.signal
})
if (response) {
batch(() => {
setFile(file)
setImageLoading(false)
setImageUrl(response)
})
}
} catch (error) {
console.log(error.name, error.message)
if (error.name === "AbortError") {
return setImageLoading(false)
}
}
}
9 replies
Sevoral
I fix seroval errors easily but I just used JSON.stringify on server and then parsed it on the client. but I wanted to know more about it. I really typed Sevoral LoL. Thanks @Brendonovich, I am working with mongodb so it might be giving me error because of ObjectId's and other types.
9 replies
Busboy "missing content-type" error
It works I do get the headers as object but busboy has this type of check which should be pass it without error but it still throws the error
module.exports = (cfg) => {
if (typeof cfg !== 'object' cfg === null)
cfg = {};
if (typeof cfg.headers !== 'object'
cfg.headers === null
|| typeof cfg.headers['content-type'] !== 'string') {
throw new Error('Missing Content-Type');
}
return getInstance(cfg);
};
4 replies