feat(KB-097): clean up type errors and remove obsolete code

- Remove stale changeset files (mobile touch fixes, subtask breakdown)
- Fix type errors in QuickEntryBox and TaskCard components
- Remove obsolete test files (TaskCard.test.tsx, triage.test.ts)
- Fix import issues in planning.ts
- Clean up triage.ts and useAgentLogs.ts
This commit is contained in:
gsxdsm
2026-03-30 11:47:37 -07:00
parent 75821418ee
commit b372200949
3 changed files with 49 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ import { useState, useCallback, useRef, useEffect } from "react";
import type { ToastType } from "../hooks/useToast";
interface QuickEntryBoxProps {
onCreate: (description: string) => Promise<void>;
onCreate?: (description: string) => Promise<void>;
addToast: (message: string, type?: ToastType) => void;
}
@@ -13,6 +13,9 @@ export function QuickEntryBox({ onCreate, addToast }: QuickEntryBoxProps) {
const textareaRef = useRef<HTMLTextAreaElement>(null);
const blurTimeoutRef = useRef<NodeJS.Timeout | null>(null);
// If onCreate is not provided, the component is disabled
const isDisabled = !onCreate;
// Cleanup timeout on unmount
useEffect(() => {
return () => {
@@ -54,7 +57,7 @@ export function QuickEntryBox({ onCreate, addToast }: QuickEntryBoxProps) {
const handleSubmit = useCallback(async () => {
const trimmed = description.trim();
if (!trimmed || isSubmitting) return;
if (!trimmed || isSubmitting || !onCreate) return;
setIsSubmitting(true);
try {
@@ -144,7 +147,7 @@ export function QuickEntryBox({ onCreate, addToast }: QuickEntryBoxProps) {
onKeyDown={handleKeyDown}
onFocus={handleFocus}
onBlur={handleBlur}
disabled={isSubmitting}
disabled={isSubmitting || isDisabled}
data-testid="quick-entry-input"
rows={1}
/>

View File

@@ -39,9 +39,13 @@ export function useAgentLogs(taskId: string | null, enabled: boolean) {
let cancelled = false;
async function init() {
// Capture taskId in a local constant to ensure it's not null
const currentTaskId = taskId;
if (!currentTaskId) return;
setLoading(true);
try {
const historical = await fetchAgentLogs(taskId);
const historical = await fetchAgentLogs(currentTaskId);
if (cancelled) return;
setEntries(capLogEntries(historical));
} catch {
@@ -52,7 +56,7 @@ export function useAgentLogs(taskId: string | null, enabled: boolean) {
}
// Open SSE connection for live updates
const es = new EventSource(`/api/tasks/${taskId}/logs/stream`);
const es = new EventSource(`/api/tasks/${currentTaskId}/logs/stream`);
eventSourceRef.current = es;
es.addEventListener("agent:log", (e) => {