Selaa lähdekoodia

fix (1.42.1 -> 1.42.2): 修复 HistoryList 和 OutputList 无限渲染问题

- 在 GenericDataTable 中移除 columnConfig 的空数组默认值,添加 undefined 检查
- 在 WorklistTable 中将 exposureProgressMap 默认值从空对象改为 null
- 避免每次渲染创建新的对象引用,防止触发 React 依赖项检查失败
- 提升应用性能和稳定性,确保列表组件正常工作

改动文件:
- src/components/GenericDataTable.tsx
- src/pages/patient/components/WorklistTable.tsx
- package.json
- CHANGELOG.md
dengdx 1 viikko sitten
vanhempi
commit
a4fdbe1cf6

+ 14 - 0
CHANGELOG.md

@@ -2,6 +2,20 @@
 
 本项目的所有重要变更都将记录在此文件中。
 
+## [1.42.2] - 2026-01-03 13:16
+
+### 修复 (Fixed)
+
+- **修复 HistoryList 和 OutputList 无限渲染问题** - 解决因默认参数创建新对象引用导致的无限渲染
+  - 在 GenericDataTable 中移除 columnConfig 的空数组默认值,添加 undefined 检查
+  - 在 WorklistTable 中将 exposureProgressMap 默认值从空对象改为 null
+  - 避免每次渲染创建新的对象引用,防止触发 React 依赖项检查失败
+  - 提升应用性能和稳定性,确保列表组件正常工作
+
+**改动文件:**
+- src/components/GenericDataTable.tsx
+- src/pages/patient/components/WorklistTable.tsx
+
 ## [1.42.1] - 2026-01-03 11:38
 
 ### 新增 (Added)

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.42.1",
+  "version": "1.42.2",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 4 - 1
src/components/GenericDataTable.tsx

@@ -113,7 +113,7 @@ export function GenericDataTable<T extends Record<string, any>>({
   dataSource,
   rowKey,
   columnDefinitions,
-  columnConfig = [],
+  columnConfig ,
   selectedIds,
   onRowClick,
   onRowDoubleClick,
@@ -122,6 +122,9 @@ export function GenericDataTable<T extends Record<string, any>>({
 }: GenericDataTableProps<T>) {
   // 根据列配置过滤和排序列
   const visibleColumns = useMemo(() => {
+    if(columnConfig === undefined) {
+      return columnDefinitions;
+    }
     // 如果没有配置,显示所有列
     if (columnConfig.length === 0) {
       return columnDefinitions.map((col) => ({

+ 1 - 1
src/pages/patient/components/WorklistTable.tsx

@@ -77,7 +77,7 @@ interface WorklistTableProps {
 const WorklistTable: React.FC<WorklistTableProps> = ({
   productName,                                // 新增
   columnConfig = [],                          // 接收配置,默认为空数组
-  exposureProgressMap = {},                   // 新增:曝光进度映射
+  exposureProgressMap = null,                   // 新增:曝光进度映射
   worklistData,
   // filters,
   // page,