Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: check localsetting exists (#1076)

boojackb92da8f123de
diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx
index 8d3edf49d..c256a9651 100644
--- a/web/src/components/Memo.tsx
+++ b/web/src/components/Memo.tsx
@@ -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;
diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx
index fa76484d4..53d39f61f 100644
--- a/web/src/components/Settings/PreferencesSection.tsx
+++ b/web/src/components/Settings/PreferencesSection.tsx
@@ -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();