- Add drag-to-resize sidebar with localStorage persistence - Rewrite issue detail page with Tiptap rich text editor, due date picker, acceptance criteria - Redesign create-issue modal with pill-based property toolbar and expand/collapse - Consolidate @multica/sdk and @multica/types into apps/web/shared/ - Simplify auth: remove verification codes, PATs, email service (dev-only login) - Add 401 unauthorized handler to redirect expired sessions to login - Fix due date format to send full RFC3339 timestamps - Increase description editor debounce to 1500ms - Remove arbitrary Tailwind values in create-issue modal - Renumber migrations (inbox_actor 012→009), remove unused migrations - UI polish across agents, settings, inbox, knowledge-base pages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
20 lines
531 B
TypeScript
20 lines
531 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import type { WSEventType } from "@/shared/types";
|
|
import { useWS } from "./provider";
|
|
|
|
type EventHandler = (payload: unknown) => void;
|
|
|
|
/**
|
|
* Hook that subscribes to a WebSocket event and calls the handler.
|
|
* Automatically unsubscribes on cleanup.
|
|
*/
|
|
export function useWSEvent(event: WSEventType, handler: EventHandler) {
|
|
const { subscribe } = useWS();
|
|
|
|
useEffect(() => {
|
|
const unsub = subscribe(event, handler);
|
|
return unsub;
|
|
}, [event, handler, subscribe]);
|
|
}
|