Reworking useLocalStorage to nav color does not flash on load.

This commit is contained in:
Roland 2024-12-18 17:31:50 -07:00
parent 0f003a6dc1
commit 7c147747f1
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 7 additions and 6 deletions

View file

@ -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