mirror of
https://github.com/roger2ai/Claude-Code-Compiled.git
synced 2026-05-07 22:29:49 +08:00
fix: useEffectEvent shim for react-reconciler 0.31 compatibility
- Create src/utils/useEffectEvent.ts (useRef + useCallback shim) - Replace react imports of useEffectEvent in BackgroundTasksDialog and AppState - CLI now boots into trust dialog successfully
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { feature } from 'bun:bundle';
|
||||
import figures from 'figures';
|
||||
import React, { type ReactNode, useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';
|
||||
import React, { type ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useEffectEvent } from '../../utils/useEffectEvent.js';
|
||||
import { isCoordinatorMode } from 'src/coordinator/coordinatorMode.js';
|
||||
import { useTerminalSize } from 'src/hooks/useTerminalSize.js';
|
||||
import { useAppState, useSetAppState } from 'src/state/AppState.js';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { feature } from 'bun:bundle';
|
||||
import React, { useContext, useEffect, useEffectEvent, useState, useSyncExternalStore } from 'react';
|
||||
import React, { useContext, useEffect, useState, useSyncExternalStore } from 'react';
|
||||
import { useEffectEvent } from '../utils/useEffectEvent.js';
|
||||
import { MailboxProvider } from '../context/mailbox.js';
|
||||
import { useSettingsChange } from '../hooks/useSettingsChange.js';
|
||||
import { logForDebugging } from '../utils/debug.js';
|
||||
|
||||
9
src/utils/useEffectEvent.ts
Normal file
9
src/utils/useEffectEvent.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useCallback, useRef } from 'react';
|
||||
|
||||
// Shim for useEffectEvent (React 19 experimental, not in react-reconciler 0.31)
|
||||
// Uses useRef to always call the latest callback without re-firing effects
|
||||
export function useEffectEvent<T extends (...args: any[]) => any>(callback: T): T {
|
||||
const ref = useRef(callback);
|
||||
ref.current = callback;
|
||||
return useCallback(((...args: any[]) => ref.current(...args)) as T, []);
|
||||
}
|
||||
Reference in New Issue
Block a user