@@ -44,7 +44,6 @@ const SocialModal = 创建可预加载懒组件(() => import('./components/featu
4444const MobileSocial = 创建可预加载懒组件 ( ( ) => import ( './components/features/Social/MobileSocial' ) ) ;
4545const CampusDesireDashboard = 创建可预加载懒组件 ( ( ) => import ( './components/features/CampusDesireDashboard' ) ) ;
4646const BDSMRelationshipModal = 创建可预加载懒组件 ( ( ) => import ( './components/features/BDSMRelationshipModal' ) ) ;
47- const BDSMTaskModal = 创建可预加载懒组件 ( ( ) => import ( './components/features/BDSMTaskModal' ) ) ;
4847const BDSMContractModal = 创建可预加载懒组件 ( ( ) => import ( './components/features/BDSMContractModal' ) ) ;
4948const BDSMSafetyModal = 创建可预加载懒组件 ( ( ) => import ( './components/features/BDSMSafetyModal' ) ) ;
5049const MobileCampusDesireApp = 创建可预加载懒组件 ( ( ) => import ( './components/features/MobileCampusDesireApp' ) ) ;
@@ -184,7 +183,8 @@ const App: React.FC = () => {
184183 state . 女主剧情规划 ,
185184 state . 开局配置 ,
186185 meta . builtinPromptEntries ,
187- meta . worldbooks
186+ meta . worldbooks ,
187+ actions
188188 ] ) ;
189189 const confirmResolverRef = React . useRef < ( ( value : boolean ) => void ) | null > ( null ) ;
190190 const 最近小说分解报错提示IDRef = React . useRef ( '' ) ;
@@ -296,7 +296,7 @@ const App: React.FC = () => {
296296
297297 const warmup = ( ) => {
298298 if ( cancelled ) return ;
299- preloadTargets . forEach ( ( target , index ) => {
299+ preloadTargets . forEach ( ( target : { preload ?: ( ) => void } , index : number ) => {
300300 window . setTimeout ( ( ) => {
301301 if ( cancelled ) return ;
302302 void target . preload ?.( ) ;
@@ -386,6 +386,8 @@ const App: React.FC = () => {
386386 return `${ m [ 1 ] } 年${ m [ 2 ] } 月${ m [ 3 ] } 日 ${ m [ 4 ] } :${ m [ 5 ] } ` ;
387387 } ;
388388
389+ // helper functions recreated each render, behaviorally stable
390+ /* eslint-disable react-hooks/exhaustive-deps */
389391 const tickerEvents = React . useMemo ( ( ) => {
390392 const ongoingEvents = Array . isArray ( state . 世界 ?. 进行中事件 ) ? state . 世界 . 进行中事件 : [ ] ;
391393 const formatted = ongoingEvents
@@ -401,6 +403,7 @@ const App: React.FC = () => {
401403
402404 return formatted . length > 0 ? formatted : state . worldEvents ;
403405 } , [ state . 世界 , state . worldEvents ] ) ;
406+ /* eslint-enable react-hooks/exhaustive-deps */
404407
405408 const 启用同人模式 = React . useMemo (
406409 ( ) => state . 开局配置 ?. 同人融合 ?. enabled === true && state . 开局配置 ?. 同人融合 ?. 启用附加小说 === true ,
@@ -430,7 +433,7 @@ const App: React.FC = () => {
430433 } , [ state . 角色 ] ) ;
431434 const 主角锚点 = React . useMemo (
432435 ( ) => actions . getPlayerCharacterAnchor ?.( ) || null ,
433- [ actions , state . apiConfig ]
436+ [ actions ]
434437 ) ;
435438 const playerProfile = React . useMemo (
436439 ( ) => ( { 姓名 : state . 角色 ?. 姓名 , 头像图片URL : 玩家头像地址 } ) ,
@@ -539,7 +542,6 @@ const App: React.FC = () => {
539542 const closeNovelDecompositionWorkbench = React . useCallback ( ( ) => setShowNovelDecompositionWorkbench ( false ) , [ ] ) ;
540543 const closeNovelWritingWorkbench = React . useCallback ( ( ) => setShowNovelWritingWorkbench ( false ) , [ ] ) ;
541544 const closeSaveLoad = React . useCallback ( ( ) => setters . setShowSaveLoad ( { show : false , mode : 'save' } ) , [ setters ] ) ;
542- const closeWorldbookManager = React . useCallback ( ( ) => setShowWorldbookManager ( false ) , [ ] ) ;
543545 const closeMobileMusic = React . useCallback ( ( ) => setShowMobileMusic ( false ) , [ ] ) ;
544546 const openWorldbookManager = React . useCallback ( ( ) => setShowWorldbookManager ( true ) , [ ] ) ;
545547 const openNovelDecompositionWorkbench = React . useCallback ( async ( ) => {
@@ -697,7 +699,7 @@ const App: React.FC = () => {
697699 default :
698700 break ;
699701 }
700- } , [ activeMobileWindow , closeAllPanels , openImageManagerWithCheck , openNovelDecompositionWorkbench , setters , 启用修炼体系 ] ) ;
702+ } , [ activeMobileWindow , closeAllPanels , openImageManagerWithCheck , openNovelDecompositionWorkbench , setters , 启用修炼体系 , actions ] ) ;
701703
702704 React . useEffect ( ( ) => {
703705 if ( ! 启用修炼体系 && state . showKungfu ) {
@@ -716,9 +718,11 @@ const App: React.FC = () => {
716718 } ;
717719 window . addEventListener ( 'keydown' , handler ) ;
718720 return ( ) => window . removeEventListener ( 'keydown' , handler ) ;
719- } , [ state . view , state . showSettings , state . showSocial , state . showInventory , state . showEquipment , state . showBattle , state . showTeam , state . showKungfu , state . showWorld , state . showMap , state . showSect , state . showTask , state . showAgreement , state . showStory , state . showHeroinePlan , state . showMemory , state . showSaveLoad , actions . openDevice ] ) ;
721+ } , [ state . view , state . showSettings , state . showSocial , state . showInventory , state . showEquipment , state . showBattle , state . showTeam , state . showKungfu , state . showWorld , state . showMap , state . showSect , state . showTask , state . showAgreement , state . showStory , state . showHeroinePlan , state . showMemory , state . showSaveLoad , actions ] ) ;
720722
721723 // 约定状态同步 → 见面预约(当约定状态变为已履行/已违约时,同步更新预约状态)
724+ // setters is a stable reference from useGame
725+ /* eslint-disable react-hooks/exhaustive-deps */
722726 React . useEffect ( ( ) => {
723727 const 校园系统 = state . 校园系统 as any ;
724728 if ( ! 校园系统 ?. 见面预约列表 ?. length || ! state . 约定列表 ?. length ) return ;
@@ -744,6 +748,7 @@ const App: React.FC = () => {
744748 setters . set校园系统 ?.( { ...校园系统 , 见面预约列表 : 更新预约列表 } ) ;
745749 }
746750 } , [ state . 约定列表 , state . 校园系统 , setters . set校园系统 ] ) ;
751+ /* eslint-enable react-hooks/exhaustive-deps */
747752
748753
749754 return (
@@ -1521,8 +1526,8 @@ const App: React.FC = () => {
15211526 character = { state . 角色 }
15221527 battle = { state . 战斗 }
15231528 onClose = { ( ) => setters . setShowBattle ( false ) }
1524- onAction = { ( 结果 ) => {
1525- console . log ( '玩家战斗行动:' , 结果 ) ;
1529+ onAction = { ( ) => {
1530+ // Battle action handler — results are tracked in state.战斗
15261531 } }
15271532 />
15281533 ) }
@@ -1910,9 +1915,6 @@ const App: React.FC = () => {
19101915 创建时间 : Date . now ( ) ,
19111916 } ] ) ;
19121917 } }
1913- isRefreshing = { meta . deviceRefreshQueue ?. some (
1914- ( t ) => t . status === 'processing'
1915- ) || false }
19161918 onSendMessage = { ( npcId : string , npcName : string , content : string ) => {
19171919 return actions . handlePrivateChatSend ?.( npcId , npcName , content ) . then ( result => {
19181920 if ( result . npcReply ) {
0 commit comments