useSettings: useMemo
This commit is contained in:
parent
ffdb744d16
commit
7934d43426
1 changed files with 3 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import { useMemo } from 'react';
|
||||
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import { settingsSchema } from 'soapbox/schemas/soapbox/settings';
|
||||
|
||||
|
@ -6,5 +8,5 @@ import { useAppSelector } from './useAppSelector';
|
|||
/** Get the user settings from the store */
|
||||
export const useSettings = () => {
|
||||
const data = useAppSelector((state) => getSettings(state));
|
||||
return settingsSchema.parse(data.toJS());
|
||||
return useMemo(() => settingsSchema.parse(data.toJS()), [data]);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue