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 = () => {
|
const Models: React.FC = () => {
|
||||||
// Initialize state with value from localStorage or default to ''
|
// Initialize state with value from localStorage or default to ''
|
||||||
const [radioSelection, setRadioSelection] = useState(() => localStorage.getItem('radioSelection') || '');
|
const [radioSelection, setRadioSelection] = useState('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleStorageChange = () => {
|
const handleStorageChange = () => {
|
||||||
setRadioSelection(localStorage.getItem('radioSelection') || '');
|
setRadioSelection(localStorage.getItem('radioSelection') || '');
|
||||||
};
|
};
|
||||||
|
handleStorageChange()
|
||||||
|
|
||||||
// Update dropdown immediately when localStorage changes internally or externally
|
// Update dropdown immediately when localStorage changes internally or externally
|
||||||
window.addEventListener('storage', handleStorageChange);
|
window.addEventListener('storage', handleStorageChange);
|
||||||
|
|
Loading…
Reference in a new issue