Files
crosscode-platform/apps/accounts/frontend/src/lib/hooks.ts
T
joshuaandClaude Opus 5.5 f202a5a88e Accounts 1.0.0 frontend and @crosscode/ui
Sign-in steps (password, sign-up, email code, two-step sign-in and its
setup with recovery codes, privacy notice, news question), forgot and
reset password, the account page, admin (people, deletions, church
profile, linked products, settings, notice, licence, audit) and setup.
Strict CSP with a nonce per page; church colours from the profile.
@crosscode/ui gets its first components (shell, card, fields, buttons).
Plan: roles stay in each product (asked 2026-11-18).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:42:45 +02:00

15 lines
621 B
TypeScript

import { useEffect, type DependencyList } from "react";
/**
* `useEffect` for loading from the API and setting state from it (as Cross Events' lib/hooks.ts):
* the React Compiler lint can't tell that apart from state derived from other state.
*/
export function useExternalEffect(run: () => void | (() => void) | Promise<unknown>, deps: DependencyList) {
useEffect(() => {
const out = run();
return typeof out === "function" ? out : undefined;
// The caller's deps, checked at the call site by exhaustive-deps (additionalHooks).
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
}