diff --git a/package-lock.json b/package-lock.json index eed84bfb..b4883bc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2864,9 +2864,6 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2883,9 +2880,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2902,9 +2896,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2921,9 +2912,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2940,9 +2928,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2959,9 +2944,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2978,9 +2960,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -2997,9 +2976,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -3016,9 +2992,6 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3041,9 +3014,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3066,9 +3036,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3091,9 +3058,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3116,9 +3080,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3141,9 +3102,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3166,9 +3124,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3191,9 +3146,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -3954,9 +3906,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3973,9 +3922,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3992,9 +3938,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -4011,9 +3954,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5357,9 +5297,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5374,9 +5311,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5391,9 +5325,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5408,9 +5339,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5425,9 +5353,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5442,9 +5367,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5459,9 +5381,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5476,9 +5395,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5493,9 +5409,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5510,9 +5423,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -5527,9 +5437,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5544,9 +5451,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -5561,9 +5465,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -9016,9 +8917,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9036,9 +8934,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -9056,9 +8951,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9076,9 +8968,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -9845,9 +9734,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9862,9 +9748,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -9879,9 +9762,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9896,9 +9776,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9913,9 +9790,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -9930,9 +9804,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9947,9 +9818,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -9964,9 +9832,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -10461,9 +10326,10 @@ "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "extraneous": true, "hasInstallScript": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -13755,6 +13621,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -14960,9 +14827,10 @@ "version": "5.0.10", "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "extraneous": true, "hasInstallScript": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -15391,9 +15259,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -15415,9 +15280,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -15439,9 +15301,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -15463,9 +15322,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/src/app/api/storyline/[storylineId]/metadata/route.ts b/src/app/api/storyline/[storylineId]/metadata/route.ts index 78f0b2ad..51b3e534 100644 --- a/src/app/api/storyline/[storylineId]/metadata/route.ts +++ b/src/app/api/storyline/[storylineId]/metadata/route.ts @@ -99,7 +99,7 @@ export async function PATCH( } // Build update payload - const update: Record = {}; + const update: { genre?: string; language?: string } = {}; if (genre) update.genre = genre; if (language) update.language = language; diff --git a/src/app/api/user/agent-update/route.ts b/src/app/api/user/agent-update/route.ts index 13a71545..6496474a 100644 --- a/src/app/api/user/agent-update/route.ts +++ b/src/app/api/user/agent-update/route.ts @@ -26,14 +26,15 @@ export async function POST(request: NextRequest) { "agent_name", "agent_description", "agent_genre", "agent_llm_model", "agent_wallet", "agent_owner", ]; - const sanitized: Record = {}; + type AgentField = "agent_name" | "agent_description" | "agent_genre" | "agent_llm_model" | "agent_wallet" | "agent_owner"; + const sanitized: Partial> = {}; for (const key of allowedKeys) { if (key in fields) { - sanitized[key] = fields[key] != null ? String(fields[key]).toLowerCase() : null; + sanitized[key as AgentField] = fields[key] != null ? String(fields[key]).toLowerCase() : null; } } // Name/description/genre/model should preserve case - for (const key of ["agent_name", "agent_description", "agent_genre", "agent_llm_model"]) { + for (const key of ["agent_name", "agent_description", "agent_genre", "agent_llm_model"] as const) { if (key in fields) { sanitized[key] = fields[key] || null; } diff --git a/src/app/profile/[address]/page.tsx b/src/app/profile/[address]/page.tsx index 8ade3a3a..b6da3ebb 100644 --- a/src/app/profile/[address]/page.tsx +++ b/src/app/profile/[address]/page.tsx @@ -122,21 +122,21 @@ export default function ProfilePage() { useEffect(() => { if (!dbUser?.steemhunt_fetched_at) { - setCooldownRemaining(0); + queueMicrotask(() => setCooldownRemaining(0)); return; } const computeRemaining = () => { const age = Date.now() - new Date(dbUser.steemhunt_fetched_at!).getTime(); return Math.max(0, COOLDOWN_MS - age); }; - setCooldownRemaining(computeRemaining()); + queueMicrotask(() => setCooldownRemaining(computeRemaining())); const interval = setInterval(() => { const r = computeRemaining(); setCooldownRemaining(r); if (r <= 0) clearInterval(interval); }, 1000); return () => clearInterval(interval); - }, [dbUser?.steemhunt_fetched_at]); + }, [dbUser?.steemhunt_fetched_at, COOLDOWN_MS]); const onCooldown = cooldownRemaining > 0; diff --git a/src/components/AgentManage.tsx b/src/components/AgentManage.tsx index 2ed5e452..56f4787b 100644 --- a/src/components/AgentManage.tsx +++ b/src/components/AgentManage.tsx @@ -126,10 +126,12 @@ export function AgentManage({ agentId, role, source }: AgentManageProps) { // Populate edit fields when metadata loads useEffect(() => { if (metadata) { - setEditName(metadata.name); - setEditDescription(metadata.description); - setEditGenre(metadata.genre ?? ""); - setEditLlmModel(metadata.llmModel ?? ""); + queueMicrotask(() => { + setEditName(metadata.name); + setEditDescription(metadata.description); + setEditGenre(metadata.genre ?? ""); + setEditLlmModel(metadata.llmModel ?? ""); + }); } }, [metadata]); diff --git a/src/components/RatingWidget.tsx b/src/components/RatingWidget.tsx index 8e4ec61f..46bd67dc 100644 --- a/src/components/RatingWidget.tsx +++ b/src/components/RatingWidget.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect, useCallback } from "react"; +import { useState, useCallback, useRef } from "react"; import { useAccount, useSignMessage } from "wagmi"; import { useQuery } from "@tanstack/react-query"; import { browserClient as publicClient } from "../../lib/rpc"; @@ -69,22 +69,14 @@ export function RatingWidget({ storylineId, tokenAddress }: RatingWidgetProps) { enabled: isConnected && !!address, }); - // Pre-fill existing rating or reset when wallet changes - useEffect(() => { - if (ratingsData && address) { - const existing = ratingsData.myRating; - if (existing) { - setSelectedRating(existing.rating); - setComment(existing.comment ?? ""); - } else { - setSelectedRating(0); - setComment(""); - } - } else if (!address) { - setSelectedRating(0); - setComment(""); - } - }, [ratingsData, address]); + // Pre-fill existing rating or reset when data changes + const myRating = ratingsData?.myRating; + const prevMyRatingRef = useRef(myRating); + if (myRating !== prevMyRatingRef.current) { + prevMyRatingRef.current = myRating; + setSelectedRating(myRating?.rating ?? 0); + setComment(myRating?.comment ?? ""); + } const submitRating = useCallback(async () => { if (!address || selectedRating === 0) return; diff --git a/src/components/ReadingMode.tsx b/src/components/ReadingMode.tsx index 31cc9d2b..6c5ef29a 100644 --- a/src/components/ReadingMode.tsx +++ b/src/components/ReadingMode.tsx @@ -19,6 +19,7 @@ interface ReadingModeProps { } export function ReadingMode({ + // eslint-disable-next-line @typescript-eslint/no-unused-vars storylineId, storylineTitle, chapters, diff --git a/src/hooks/useDraft.ts b/src/hooks/useDraft.ts index 4ef44420..32ae39b5 100644 --- a/src/hooks/useDraft.ts +++ b/src/hooks/useDraft.ts @@ -40,7 +40,7 @@ export function useDraft>( didRestore = true; } } - if (didRestore) setRestored(true); + if (didRestore) queueMicrotask(() => setRestored(true)); } catch { // Corrupt data — ignore }