bug修改

This commit is contained in:
Developer
2026-05-12 20:27:30 +08:00
parent b0929a8094
commit 53c67079a1
23 changed files with 1026 additions and 387 deletions

30
store/miniExclusion.ts Normal file
View File

@@ -0,0 +1,30 @@
/**
* MiniPlayer ↔ LiveMiniPlayer 互斥协调。
* 通过 zustand subscribe 在外部串联两个 store避免它们直接互相 import
* 造成循环依赖(曾导致 Metro / TS 编译时内存暴涨)。
*
* 仅需在 app 启动时 import 一次_layout.tsx即可生效。
*/
import { useVideoStore } from './videoStore';
import { useLiveStore } from './liveStore';
let initialized = false;
export function initMiniExclusion() {
if (initialized) return;
initialized = true;
// 视频 mini 激活 → 清掉直播 mini
useVideoStore.subscribe((state, prev) => {
if (state.isActive && !prev.isActive && useLiveStore.getState().isActive) {
useLiveStore.getState().clearLive();
}
});
// 直播 mini 激活 → 清掉视频 mini
useLiveStore.subscribe((state, prev) => {
if (state.isActive && !prev.isActive && useVideoStore.getState().isActive) {
useVideoStore.getState().clearVideo();
}
});
}