forked from React-Group/interstellar_ai
error fix Models.tsx
This commit is contained in:
parent
9b48be0202
commit
85deb5d64b
1 changed files with 3 additions and 2 deletions
|
@ -29,12 +29,13 @@ const modelDropdown = {
|
|||
|
||||
const Models: React.FC = () => {
|
||||
// Initialize state with value from localStorage or default to ''
|
||||
const [radioSelection, setRadioSelection] = useState(() => localStorage.getItem('radioSelection') || '');
|
||||
const [radioSelection, setRadioSelection] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
const handleStorageChange = () => {
|
||||
setRadioSelection(localStorage.getItem('radioSelection') || '');
|
||||
};
|
||||
handleStorageChange()
|
||||
|
||||
// Update dropdown immediately when localStorage changes internally or externally
|
||||
window.addEventListener('storage', handleStorageChange);
|
||||
|
|
Loading…
Reference in a new issue