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