@thefreshop/tb 1.0.14 → 1.0.15
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.
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -62,11 +62,13 @@ const TbProvider = ({ children }) => {
|
|
|
62
62
|
});
|
|
63
63
|
// 2. 상태가 변경될 때마다 sessionStorage 저장하는 useEffect 추가
|
|
64
64
|
React.useEffect(() => {
|
|
65
|
+
// page 속성(React 컴포넌트)을 제외하고 sessionStorage에 저장
|
|
66
|
+
const tabsToSave = tabs.map(({ page, ...rest }) => rest);
|
|
65
67
|
const stateToSave = {
|
|
66
|
-
tabs,
|
|
68
|
+
tabs: tabsToSave,
|
|
67
69
|
// ... 저장할 다른 상태들 ...
|
|
68
70
|
};
|
|
69
|
-
sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(stateToSave));
|
|
71
|
+
sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(stateToSave)); // 순환 구조 오류 방지
|
|
70
72
|
}, [tabs, currentTab /* ... 다른 상태 의존성 ... */]);
|
|
71
73
|
const addTabs = (tab) => {
|
|
72
74
|
setCurrentTab(tab);
|