From d979084c1d66e22c4d21d8ea8cc2c560a972ed81 Mon Sep 17 00:00:00 2001 From: ynwd <10122431+ynwd@users.noreply.github.com> Date: Sun, 1 Dec 2024 11:12:18 +0700 Subject: [PATCH] fix: blank screen --- core/server/mod.ts | 13 ++++++++----- modules/hook/health.ts | 4 +--- modules/index/index.handler.ts | 2 +- modules/index/index.navigation.tsx | 24 ++++++++++++++++++++---- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/core/server/mod.ts b/core/server/mod.ts index b580969a..cbd095cf 100644 --- a/core/server/mod.ts +++ b/core/server/mod.ts @@ -461,7 +461,7 @@ if (root) fetchProps(root); if (!match) continue; const x = await m.handler( this.#transformRequest(req, match?.pathname.groups, u), - this.#transformCtx(info, u, this.serverOptions), + this.#transformCtx(info, u, this.serverOptions, false), ) as any; if (x instanceof Response) { @@ -495,12 +495,15 @@ if (root) fetchProps(root); info: Deno.ServeHandlerInfo, url: URL, options: Record, + page?: boolean, ) => { const ctx = options as Context; const r = new Render(this); - ctx.render = (jsx: T) => { - return r.renderJsx(jsx as JSX.Element); - }; + if (!page) { + ctx.render = (jsx: T) => { + return r.renderJsx(jsx as JSX.Element); + }; + } ctx.send = (data: T, status = 200) => { return createResponse(data, status); }; @@ -529,7 +532,7 @@ if (root) fetchProps(root); } } - const ctx = this.#transformCtx(info, url, this.serverOptions); + const ctx = this.#transformCtx(info, url, this.serverOptions, false); return this.#record[id] = { handler, ctx, params, url }; }; diff --git a/modules/hook/health.ts b/modules/hook/health.ts index 2f2ad46b..bff63db7 100644 --- a/modules/hook/health.ts +++ b/modules/hook/health.ts @@ -26,9 +26,7 @@ const useHealthCheck = () => { useEffect(() => { fetchHealthStatus(); - - const intervalId = setInterval(fetchHealthStatus, 30 * 1000); - + const intervalId = setInterval(fetchHealthStatus, 60 * 1000); return () => clearInterval(intervalId); }, []); diff --git a/modules/index/index.handler.ts b/modules/index/index.handler.ts index a62de07f..99788c6d 100644 --- a/modules/index/index.handler.ts +++ b/modules/index/index.handler.ts @@ -56,5 +56,5 @@ export const handler = async (req: HttpRequest, ctx: Context) => { destination: "blog/queue", }; - return await ctx.render(obj); + return ctx.render(obj); }; diff --git a/modules/index/index.navigation.tsx b/modules/index/index.navigation.tsx index 502ede8e..6839c331 100644 --- a/modules/index/index.navigation.tsx +++ b/modules/index/index.navigation.tsx @@ -189,6 +189,16 @@ function Item(props: { data: any }) { setShow(!show); }; + const handleSendMessage = (_v: any) => { + // create room + // add to users chats + throw new Error("Function not implemented."); + }; + + const handleSeeProfile = (_v: any) => { + throw new Error("Function not implemented."); + }; + return (
  • -
    +
    handleSendMessage(props.data)} + > Send Message
    -
    - Profile +
    handleSeeProfile(props.data)} + > + See Profile