fix: check localsetting exists (#1076)

This commit is contained in:
boojack 2023-02-11 22:54:13 +08:00 committed by GitHub
parent bdf0c44246
commit b92da8f123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,6 @@ const Memo: React.FC<Props> = (props: Props) => {
const locationStore = useLocationStore();
const userStore = useUserStore();
const memoStore = useMemoStore();
const { localSetting } = userStore.state.user as User;
const [displayTimeStr, setDisplayTimeStr] = useState<string>(getFormatedMemoTimeStr(memo.displayTs, i18n.language));
const memoContainerRef = useRef<HTMLDivElement>(null);
const isVisitorMode = userStore.isVisitorMode();
@ -152,7 +151,8 @@ const Memo: React.FC<Props> = (props: Props) => {
};
const handleMemoContentDoubleClick = (e: React.MouseEvent) => {
if (!localSetting.enableDoubleClickEditing) {
const loginUser = userStore.state.user;
if (loginUser && !loginUser.localSetting.enableDoubleClickEditing) {
return;
}
const targetEl = e.target as HTMLElement;

View File

@ -1,11 +1,11 @@
import { Select, Switch, Option } from "@mui/joy";
import React from "react";
import { useTranslation } from "react-i18next";
import { useGlobalStore, useUserStore } from "../../store/module";
import { VISIBILITY_SELECTOR_ITEMS, MEMO_DISPLAY_TS_OPTION_SELECTOR_ITEMS } from "../../helpers/consts";
import AppearanceSelect from "../AppearanceSelect";
import LocaleSelect from "../LocaleSelect";
import "../../less/settings/preferences-section.less";
import React from "react";
const PreferencesSection = () => {
const { t } = useTranslation();