perf(store): 优化 selector 性能并移除未使用代码

- 使用 createSelector 和 useMemo 优化 medications 和 tabBarConfig 的 selector,避免不必要的重渲染
- 添加空数组常量 EMPTY_RECORDS_ARRAY,减少对象创建开销
- 移除 _layout.tsx 中未使用的路由配置
- 删除过时的通知实现文档
- 移除 pushNotificationManager 中未使用的 token 刷新监听器
- 禁用开发环境的后台任务调试工具初始化
This commit is contained in:
richarjiang
2025-11-24 11:11:29 +08:00
parent c1c9f22111
commit 3db2d39a58
6 changed files with 88 additions and 393 deletions

View File

@@ -64,7 +64,13 @@ export default function MedicationsScreen() {
// 从 Redux 获取数据
const selectedKey = selectedDate.format('YYYY-MM-DD');
const medicationsForDay = useAppSelector((state) => selectMedicationDisplayItemsByDate(selectedKey)(state));
// 使用 useMemo 缓存 selector 实例,避免每次渲染都创建新的 selector
const medicationSelector = useMemo(
() => selectMedicationDisplayItemsByDate(selectedKey),
[selectedKey]
);
const medicationsForDay = useAppSelector(medicationSelector);
const handleOpenAddSheet = useCallback(() => {
setAddSheetVisible(true);