mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-04 13:49:57 -05:00
Reworking useLocalStorage to nav color does not flash on load.
This commit is contained in:
parent
0f003a6dc1
commit
7c147747f1
2 changed files with 7 additions and 6 deletions
|
|
@ -76,9 +76,9 @@ function useNavColorSetting() {
|
|||
const [navColor, setNavColor] = useLocalStorage('nav_color', 'violet');
|
||||
|
||||
React.useEffect(() => {
|
||||
const newColor = settings.nav_color || 'violet';
|
||||
setNavColor(newColor);
|
||||
localStorage.setItem('nav_color', newColor);
|
||||
if (!_.isEmpty(settings)) {
|
||||
setNavColor(settings.nav_color);
|
||||
}
|
||||
}, [settings.nav_color]);
|
||||
|
||||
return navColor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue