mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-22 22:57:35 +08:00
fix: keep secondary selection unchange when changing primary selection
This commit is contained in:
@@ -226,20 +226,13 @@ function DoubanPageClient() {
|
|||||||
// 处理选择器变化
|
// 处理选择器变化
|
||||||
const handlePrimaryChange = useCallback(
|
const handlePrimaryChange = useCallback(
|
||||||
(value: string) => {
|
(value: string) => {
|
||||||
// 立即设置loading状态
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
// 批量更新状态 - React 18会自动批处理这些更新
|
|
||||||
setPrimarySelection(value);
|
setPrimarySelection(value);
|
||||||
// 电影类型时,重置二级选择器为第一个选项
|
|
||||||
if (type === 'movie') {
|
|
||||||
setSecondarySelection('全部');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[type]
|
[type]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSecondaryChange = useCallback((value: string) => {
|
const handleSecondaryChange = useCallback((value: string) => {
|
||||||
// 立即设置loading状态
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setSecondarySelection(value);
|
setSecondarySelection(value);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user