@zat-design/sisyphus-react 4.5.7 → 4.5.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -59,12 +59,15 @@ export const useTabsState = options => {
|
|
|
59
59
|
delete restoredState.activeTab;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
restoredState.tabsList = restoredState.tabsList.map(tab =>
|
|
62
|
+
// 兼容旧缓存:Ant Tabs 的 onChange 始终返回字符串 key;旧版本可能保存数字 id,
|
|
63
|
+
// 若不归一化,严格比较会导致恢复后的标签无法切换。
|
|
64
|
+
restoredState.tabsList = restoredState.tabsList.map(tab => ({
|
|
65
65
|
...tab,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
id: String(tab.id),
|
|
67
|
+
pinned: tab.pinned === undefined ? derivePinned(tab) : tab.pinned
|
|
68
|
+
}));
|
|
69
|
+
restoredState.activeKey = restoredState.activeKey === undefined || restoredState.activeKey === null ? '' : String(restoredState.activeKey);
|
|
70
|
+
restoredState.activeTabInfo = restoredState.tabsList.find(tab => tab.id === restoredState.activeKey);
|
|
68
71
|
setState(restoredState);
|
|
69
72
|
}
|
|
70
73
|
setIsInitialized(true);
|