zeb
zeb
SSolidJS
Created by zeb on 7/1/2023 in #support
Empty event with useRequest()
Is there anything special I need to do to get the package on the right bundling correctly?
6 replies
SSolidJS
Created by zeb on 7/1/2023 in #support
Empty event with useRequest()
Yeah when being imported from an outside package using pnpm link the useRequests get compiled into a useRequest and a useRequest$1 with the later one functioning
6 replies
SSolidJS
Created by zeb on 7/1/2023 in #support
Empty event with useRequest()
6 replies
SSolidJS
Created by zeb on 7/1/2023 in #support
Empty event with useRequest()
responseHeaders is always undefined and event seems to never have any properties
6 replies
SSolidJS
Created by zeb on 7/1/2023 in #support
Empty event with useRequest()
I have an incredibly basic component that's just trying to append some cache headers:
export function Cache({
cacheControl,
cacheTag,
etag,
expires,
lastModified,
}: CacheProps) {
const event = useRequest();

if (isServer) {
console.log(event);
cacheControl && event.responseHeaders.append("Cache-Control", cacheControl);
cacheTag && event.responseHeaders.append("Cache-Tag", cacheTag);
etag && event.responseHeaders.append("ETag", etag);
expires && event.responseHeaders.append("Expires", expires);
lastModified && event.responseHeaders.append("Last-Modified", lastModified);
}

// We don't want to actually render anything.
return null;
}
export function Cache({
cacheControl,
cacheTag,
etag,
expires,
lastModified,
}: CacheProps) {
const event = useRequest();

if (isServer) {
console.log(event);
cacheControl && event.responseHeaders.append("Cache-Control", cacheControl);
cacheTag && event.responseHeaders.append("Cache-Tag", cacheTag);
etag && event.responseHeaders.append("ETag", etag);
expires && event.responseHeaders.append("Expires", expires);
lastModified && event.responseHeaders.append("Last-Modified", lastModified);
}

// We don't want to actually render anything.
return null;
}
6 replies