()
| 123 | // Save tabs immediately when window is about to close |
| 124 | useEffect(() => { |
| 125 | const handleBeforeUnload = () => { |
| 126 | if (isInitialized.current && tabs.length > 0) { |
| 127 | TabPersistenceService.saveTabs(tabs, activeTabId); |
| 128 | } |
| 129 | }; |
| 130 | |
| 131 | window.addEventListener('beforeunload', handleBeforeUnload); |
| 132 |