useSettings: useMemo

This commit is contained in:
Alex Gleason 2024-02-13 23:24:07 -06:00
parent ffdb744d16
commit 7934d43426
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -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]);
};