From 428d59543a1db2f3455b5146bb8a2f421c97e019 Mon Sep 17 00:00:00 2001 From: maretol Date: Tue, 14 Jan 2025 19:59:14 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=9E=E3=82=A6=E3=82=B9=E3=82=A4?= =?UTF-8?q?=E3=83=99=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97?= =?UTF-8?q?=E3=81=A6=E8=A6=8B=E6=A0=84=E3=81=88=E3=82=92=E8=89=AF=E3=81=8F?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/components/middle/comicbook.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pages/components/middle/comicbook.tsx b/pages/components/middle/comicbook.tsx index a18bfce..b842fd0 100644 --- a/pages/components/middle/comicbook.tsx +++ b/pages/components/middle/comicbook.tsx @@ -184,6 +184,10 @@ export default function ComicBook(props: ComicBookProps) { } } + const mouseLeaveEvent = () => { + setZoneFlag('none') + } + const onInit = useCallback( (api: CarouselApi) => { setScrollSnaps(api?.scrollSnapList()) @@ -278,6 +282,7 @@ export default function ComicBook(props: ComicBookProps) { ref={comicDivRef} onClick={mouseClickEvent} onMouseMove={mouseMoveEvent} + onMouseLeave={mouseLeaveEvent} > From 932611a26d743e3d26cd5ab89fbdb0fda8786689 Mon Sep 17 00:00:00 2001 From: maretol Date: Tue, 14 Jan 2025 20:25:27 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=87=E3=83=BC=E3=82=BF=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E5=87=A6=E7=90=86=E3=82=92=E3=83=A1=E3=83=A2=E5=8C=96?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/lib/api/workers.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pages/lib/api/workers.ts b/pages/lib/api/workers.ts index b013ac5..4ac01be 100644 --- a/pages/lib/api/workers.ts +++ b/pages/lib/api/workers.ts @@ -1,11 +1,21 @@ import { getRequestContext } from '@cloudflare/next-on-pages' import { bandeDessineeResult, categoryAPIResult, contentsAPIResult, infoAPIResult, OGPResult } from 'api-types' import { getLocalEnv, getNodeEnv } from '../env' +import { cache } from 'react' // const revalidateTime = 0 // 無効にする。どうやらnext.jsのバグを踏んでいるっぽい const dev = getNodeEnv() === 'development' -async function getOGPData(targetURL: string) { +const getOGPData = cache(getOGPDataOrigin) +const getCMSContents = cache(getCMSContentsOrigin) +const getCMSContent = cache(getCMSContentOrigin) +const getCMSContentsWithTags = cache(getCMSContentsWithTagsOrigin) +const getTags = cache(getTagsOrigin) +const getInfo = cache(getInfoOrigin) +const getBandeDessinee = cache(getBandeDessineeOrigin) +const getBandeDessineeByID = cache(getBandeDessineeByIDOrigin) + +async function getOGPDataOrigin(targetURL: string) { const { env } = getRequestContext() // cacheに有無を確認する @@ -41,7 +51,7 @@ async function getOGPData(targetURL: string) { return data } -async function getCMSContents(offset?: number, limit?: number) { +async function getCMSContentsOrigin(offset?: number, limit?: number) { const { env } = getRequestContext() const cache = await env.CMS_CACHE.get(`contents_${offset}_${limit}`) @@ -63,13 +73,13 @@ async function getCMSContents(offset?: number, limit?: number) { const data = (await res.json()) as { contents: contentsAPIResult[]; total: number } // cacheに保存する - // 有効期間は1分。長く保持すると、記事の更新が反映されないため - await env.CMS_CACHE.put(`contents_${offset}_${limit}`, JSON.stringify(data), { expirationTtl: 60 }) + // 有効期間は30分。長く保持すると、記事の更新が反映されないため + await env.CMS_CACHE.put(`contents_${offset}_${limit}`, JSON.stringify(data), { expirationTtl: 60 * 30 }) return data } -async function getCMSContent(articleID: string, draftKey?: string) { +async function getCMSContentOrigin(articleID: string, draftKey?: string) { const { env } = getRequestContext() const cache = await env.CMS_CACHE.get(`content_${articleID}`) @@ -107,7 +117,7 @@ async function getCMSContent(articleID: string, draftKey?: string) { return data } -async function getCMSContentsWithTags(tagIDs: string[], offset?: number, limit?: number) { +async function getCMSContentsWithTagsOrigin(tagIDs: string[], offset?: number, limit?: number) { const { env } = getRequestContext() // tagIDsをソートしてキャッシュのキーにしてcacheの有無を確認 @@ -140,7 +150,7 @@ async function getCMSContentsWithTags(tagIDs: string[], offset?: number, limit?: return data } -async function getTags() { +async function getTagsOrigin() { const { env } = getRequestContext() // cacheに有無を確認する @@ -167,7 +177,7 @@ async function getTags() { return data } -async function getInfo() { +async function getInfoOrigin() { const { env } = getRequestContext() // cacheに有無を確認する @@ -194,7 +204,7 @@ async function getInfo() { return data } -async function getBandeDessinee(offset?: number, limit?: number) { +async function getBandeDessineeOrigin(offset?: number, limit?: number) { const { env } = getRequestContext() const cache = await env.CMS_CACHE.get(`bande_dessinee_${offset}_${limit}`) @@ -222,7 +232,7 @@ async function getBandeDessinee(offset?: number, limit?: number) { return data } -async function getBandeDessineeByID(contentID: string, draftKey?: string) { +async function getBandeDessineeByIDOrigin(contentID: string, draftKey?: string) { const { env } = getRequestContext() const cache = await env.CMS_CACHE.get(`bande_dessinee_${contentID}`)