diff --git a/packages/react/components/Editor/index.mjs b/packages/react/components/Editor/index.mjs index b2470381ac9..9a5390c3aaa 100644 --- a/packages/react/components/Editor/index.mjs +++ b/packages/react/components/Editor/index.mjs @@ -118,8 +118,12 @@ export const Editor = ({ const { account } = useAccount() + // this should be just account.control, but there was a bug where a non-logged-in user had an + // object stored in account.control in localStorage instead of an integer + const ux = Number.isInteger(account.control) ? account.control : 3 + if (state.ui?.ux === undefined) { - passDownState.ui = { ...(state.ui || {}), ux: account.control } + passDownState.ui = { ...(state.ui || {}), ux: ux } } return ( diff --git a/packages/react/hooks/useAccount/index.mjs b/packages/react/hooks/useAccount/index.mjs index ecfb6fa1b6d..f98807c9f05 100644 --- a/packages/react/hooks/useAccount/index.mjs +++ b/packages/react/hooks/useAccount/index.mjs @@ -1,11 +1,11 @@ import useLocalStorageState from 'use-local-storage-state' -import { control as defaultControlLevel } from '@freesewing/config' +import { control as controlConfig } from '@freesewing/config' /* * When there is no account, we use this making it easy to check for username * or control */ -const noAccount = { username: false, control: defaultControlLevel } +const noAccount = { username: false, control: controlConfig.dflt } /* * FreeSewing's useAccount hook. Grants access to the (data in the) user's account