diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/BlockPopover/BlockPopover.hooks.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/BlockPopover/BlockPopover.hooks.tsx
index 81c9cd0e4c..a86f5e8e9e 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/BlockPopover/BlockPopover.hooks.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/BlockPopover/BlockPopover.hooks.tsx
@@ -42,7 +42,7 @@ export function useBlockPopover({
}, [dispatch, docId, id, onAfterClose]);
const selectBlock = useCallback(() => {
- dispatch(
+ void dispatch(
setRectSelectionThunk({
docId,
selection: [id],
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/useCopy.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/useCopy.ts
index 2c31f9ab95..0a34e4971c 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/useCopy.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/useCopy.ts
@@ -19,7 +19,8 @@ export function useCopy(container: HTMLDivElement) {
e.clipboardData?.setData(clipboardTypes.TEXT, data.text);
e.clipboardData?.setData(clipboardTypes.HTML, data.html);
};
- dispatch(
+
+ void dispatch(
copyThunk({
setClipboardData,
controller,
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/usePaste.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/usePaste.ts
index a2cc09d643..6ed3c9fd6b 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/usePaste.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/CopyPasteHooks/usePaste.ts
@@ -1,4 +1,4 @@
-import { useCallback, useContext, useEffect } from 'react';
+import { useCallback, useEffect } from 'react';
import { useAppDispatch } from '$app/stores/store';
import { pasteThunk } from '$app_reducers/document/async-actions/copy_paste';
import { clipboardTypes } from '$app/constants/document/copy_paste';
@@ -12,7 +12,7 @@ export function usePaste(container: HTMLDivElement) {
if (!controller) return;
e.stopPropagation();
e.preventDefault();
- dispatch(
+ void dispatch(
pasteThunk({
controller,
data: {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useCommonKeyEvents.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useCommonKeyEvents.ts
index 84a95e5bd9..e7da44baf8 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useCommonKeyEvents.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useCommonKeyEvents.ts
@@ -12,8 +12,6 @@ import { useAppDispatch } from '$app/stores/store';
import { isFormatHotkey, parseFormat } from '$app/utils/document/format';
import { toggleFormatThunk } from '$app_reducers/document/async-actions/format';
import { useSubscribeDocument } from '$app/components/document/_shared/SubscribeDoc.hooks';
-import { getBlock } from '$app/components/document/_shared/SubscribeNode.hooks';
-import Delta from 'quill-delta';
export function useCommonKeyEvents(id: string) {
const { focused, caretRef } = useFocused(id);
@@ -35,7 +33,7 @@ export function useCommonKeyEvents(id: string) {
handler: (e: React.KeyboardEvent
) => {
e.preventDefault();
if (!controller) return;
- dispatch(backspaceDeleteActionForBlockThunk({ id, controller }));
+ void dispatch(backspaceDeleteActionForBlockThunk({ id, controller }));
},
},
{
@@ -45,7 +43,7 @@ export function useCommonKeyEvents(id: string) {
},
handler: (e: React.KeyboardEvent) => {
e.preventDefault();
- dispatch(upDownActionForBlockThunk({ docId, id }));
+ void dispatch(upDownActionForBlockThunk({ docId, id }));
},
},
{
@@ -55,7 +53,7 @@ export function useCommonKeyEvents(id: string) {
},
handler: (e: React.KeyboardEvent) => {
e.preventDefault();
- dispatch(upDownActionForBlockThunk({ docId, id, down: true }));
+ void dispatch(upDownActionForBlockThunk({ docId, id, down: true }));
},
},
{
@@ -66,7 +64,7 @@ export function useCommonKeyEvents(id: string) {
handler: (e: React.KeyboardEvent) => {
e.preventDefault();
e.stopPropagation();
- dispatch(leftActionForBlockThunk({ docId, id }));
+ void dispatch(leftActionForBlockThunk({ docId, id }));
},
},
{
@@ -76,7 +74,7 @@ export function useCommonKeyEvents(id: string) {
},
handler: (e: React.KeyboardEvent) => {
e.preventDefault();
- dispatch(rightActionForBlockThunk({ docId, id }));
+ void dispatch(rightActionForBlockThunk({ docId, id }));
},
},
{
@@ -87,7 +85,7 @@ export function useCommonKeyEvents(id: string) {
const format = parseFormat(e);
if (!format) return;
- dispatch(
+ void dispatch(
toggleFormatThunk({
format,
controller,
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useDelta.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useDelta.ts
index 98baf30121..9d690d9b0a 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useDelta.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useDelta.ts
@@ -1,5 +1,5 @@
import { useSubscribeNode } from '$app/components/document/_shared/SubscribeNode.hooks';
-import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
+import { useCallback, useEffect, useMemo, useRef } from 'react';
import { useAppDispatch } from '$app/stores/store';
import { updateNodeDeltaThunk } from '$app_reducers/document/async-actions';
import Delta, { Op } from 'quill-delta';
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useSelection.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useSelection.ts
index 92517f5720..563241fec3 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useSelection.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/EditorHooks/useSelection.ts
@@ -19,8 +19,8 @@ export function useSelection(id: string) {
const { docId } = useSubscribeDocument();
const storeRange = useCallback(
- (range: RangeStatic) => {
- dispatch(storeRangeThunk({ id, range, docId }));
+ async (range: RangeStatic) => {
+ await dispatch(storeRangeThunk({ id, range, docId }));
},
[docId, id, dispatch]
);
@@ -38,7 +38,7 @@ export function useSelection(id: string) {
},
})
);
- storeRange(range);
+ void storeRange(range);
},
[docId, id, dispatch, storeRange]
);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/CodeInline.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/CodeInline.tsx
index 4f2c031602..f28892ab22 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/CodeInline.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/CodeInline.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-function CodeInline({ text, children, selected }: { text: string; children: React.ReactNode; selected: boolean }) {
+function CodeInline({ children, selected }: { text: string; children: React.ReactNode; selected: boolean }) {
return (
{
+ async (node: HTMLSpanElement) => {
const selection = getSelection(node);
if (!selection) return;
- dispatch(
+ await dispatch(
createTemporary({
docId,
state: {
@@ -57,7 +57,7 @@ function FormulaInline({
getSelection={getSelection}
isFirst={isFirst}
isLast={isLast}
- renderNode={() => }
+ renderNode={() => }
>
{children}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/LinkInline.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/LinkInline.tsx
index 070ec257f0..ebb5c0f4c2 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/LinkInline.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/LinkInline.tsx
@@ -26,17 +26,18 @@ function LinkInline({
const dispatch = useAppDispatch();
const onClick = useCallback(
- (e: React.MouseEvent) => {
+ async (e: React.MouseEvent) => {
if (!ref.current) return;
const selection = getSelection(ref.current);
if (!selection) return;
const rect = ref.current?.getBoundingClientRect();
+
if (!rect) return;
e.stopPropagation();
e.preventDefault();
- dispatch(
+ await dispatch(
createTemporary({
docId,
state: {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/PageInline.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/PageInline.tsx
index a97726aded..6786ba8389 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/PageInline.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/InlineBlock/PageInline.tsx
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { pageTypeMap } from '$app/constants';
import { LinearProgress } from '@mui/material';
-import Tooltip from "@mui/material/Tooltip";
+import Tooltip from '@mui/material/Tooltip';
function PageInline({ pageId }: { pageId: string }) {
const { t } = useTranslation();
@@ -18,12 +18,14 @@ function PageInline({ pageId }: { pageId: string }) {
const controller = new PageController(id);
const page = await controller.getPage();
+
setCurrentPage(page);
}, []);
const navigateToPage = useCallback(
(page: Page) => {
const pageType = pageTypeMap[page.layout];
+
navigate(`/page/${pageType}/${page.id}`);
},
[navigate]
@@ -31,14 +33,12 @@ function PageInline({ pageId }: { pageId: string }) {
useEffect(() => {
if (!page) {
- loadPage(pageId);
+ void loadPage(pageId);
} else {
setCurrentPage(page);
}
-
}, [page, loadPage, pageId]);
-
return currentPage ? (
- {currentPage.icon?.value || }
- {currentPage.name || t('menuAppHeader.defaultNewPageName')}
-
+ {currentPage.icon?.value || }
+ {currentPage.name || t('menuAppHeader.defaultNewPageName')}
+
-
) : (
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/TextLeaf.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/TextLeaf.tsx
index 83bd7fe680..6e2e87bb64 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/TextLeaf.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/TextLeaf.tsx
@@ -92,6 +92,7 @@ const TextLeaf = (props: TextLeafProps) => {
}
const mention = leaf.mention;
+
if (mention && mention.type === MentionType.PAGE && leaf.text) {
newChildren = (
0;
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, path] = editor.node(currentSelection);
if (removeMark) {
@@ -113,9 +113,10 @@ export function useEditor({
const decorate = useCallback(
(entry: NodeEntry) => {
- const [node, path] = entry;
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const [_, path] = entry;
- const ranges: Range[] = [
+ return [
getDecorateRange(path, decorateSelection, {
selection_high_lighted: true,
}),
@@ -123,8 +124,6 @@ export function useEditor({
temporary: true,
}),
].filter((range) => range !== null) as Range[];
-
- return ranges;
},
[temporarySelection, decorateSelection, getDecorateRange]
);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
index f377567d52..ba4669db6c 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SlateEditor/useSlateYjs.ts
@@ -21,6 +21,7 @@ export function useSlateYjs({ delta, onChange }: { delta?: Delta; onChange: (ops
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const editor = useMemo(() => withYjs(withMarkdown(withReact(createEditor())), sharedType), []);
// Connect editor in useEffect to comply with concurrent mode requirements.
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeMention.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeMention.hooks.ts
index 17d103a30d..2043209b40 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeMention.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeMention.hooks.ts
@@ -7,6 +7,7 @@ const initialState: MentionState = {
open: false,
blockId: '',
};
+
export function useSubscribeMentionState() {
const { docId } = useSubscribeDocument();
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeNode.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeNode.hooks.ts
index c687177c6d..0efefa4621 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeNode.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeNode.hooks.ts
@@ -18,14 +18,17 @@ export function useSubscribeNode(id: string) {
}>((state) => {
const documentState = state[DOCUMENT_NAME][docId];
const node = documentState?.nodes[id];
+
// if node is root, return page name
if (!node?.parent) {
const delta = state.pages?.pageMap[docId]?.name;
+
return {
node,
delta: delta ? JSON.stringify(new Delta().insert(delta)) : '',
};
}
+
const externalId = node?.externalId;
return {
@@ -51,7 +54,9 @@ export function useSubscribeNode(id: string) {
// Memoize the node and its children
// So that the component will not be re-rendered when other node is changed
// It very important for performance
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const memoizedNode = useMemo(() => node, [JSON.stringify(node)]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const memoizedChildIds = useMemo(() => childIds, [JSON.stringify(childIds)]);
return {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeSelection.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeSelection.hooks.ts
index 649d33bc38..fa1ee30fd1 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeSelection.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/SubscribeSelection.hooks.ts
@@ -2,7 +2,7 @@ import { useAppSelector } from '$app/stores/store';
import { RangeState, RangeStatic } from '$app/interfaces/document';
import { useMemo, useRef } from 'react';
import { useSubscribeDocument } from '$app/components/document/_shared/SubscribeDoc.hooks';
-import { RANGE_NAME, TEMPORARY_NAME, TEXT_LINK_NAME } from '$app/constants/document/name';
+import { RANGE_NAME, TEMPORARY_NAME } from '$app/constants/document/name';
export function useSubscribeDecorate(id: string) {
const { docId } = useSubscribeDocument();
@@ -51,7 +51,7 @@ export function useFocused(id: string) {
}
export function useRangeRef() {
- const { docId, controller } = useSubscribeDocument();
+ const { docId } = useSubscribeDocument();
const rangeRef = useRef();
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryLink.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryLink.tsx
index 117f787b1a..f16352a31b 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryLink.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryLink.tsx
@@ -2,8 +2,9 @@ import React from 'react';
import { AddLinkOutlined } from '@mui/icons-material';
import { useTranslation } from 'react-i18next';
-function TemporaryLink({ href = '', text = '' }: { href?: string; text?: string }) {
+function TemporaryLink({ text = '' }: { href?: string; text?: string }) {
const { t } = useTranslation();
+
return (
{text ? (
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryPopover.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryPopover.tsx
index 6f27a871bf..ec53767774 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryPopover.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/TemporaryPopover.tsx
@@ -17,7 +17,6 @@ function TemporaryPopover() {
const anchorPosition = useMemo(() => temporaryState?.popoverPosition, [temporaryState]);
const open = Boolean(anchorPosition);
const id = temporaryState?.id;
- const type = temporaryState?.type;
const dispatch = useAppDispatch();
const { docId, controller } = useSubscribeDocument();
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/index.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/index.tsx
index 4afe2ae2c6..4e9460dbf3 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/index.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TemporaryInput/index.tsx
@@ -77,6 +77,7 @@ function TemporaryInput({
useEffect(() => {
const match = getMatch();
+
setMatch(match);
}, [getMatch]);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/TurnInto.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/TurnInto.hooks.ts
index edbda07333..1f1df71304 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/TurnInto.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/TurnInto.hooks.ts
@@ -12,7 +12,7 @@ export function useTurnInto({ node, onClose }: { node: NestedBlock; onClose?: ()
const { controller, docId } = useSubscribeDocument();
const turnIntoBlock = useCallback(
- async (type: BlockType, isSelected: boolean, data?: BlockData) => {
+ async (type: BlockType, isSelected: boolean, data?: BlockData) => {
if (!controller || isSelected) {
onClose?.();
return;
@@ -35,7 +35,7 @@ export function useTurnInto({ node, onClose }: { node: NestedBlock; onClose?: ()
);
onClose?.();
- dispatch(
+ await dispatch(
setRectSelectionThunk({
docId,
selection: [newBlockId as string],
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/index.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/index.tsx
index eb3661fb51..b1388ff6ce 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/index.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/TurnInto/index.tsx
@@ -57,7 +57,7 @@ const TurnIntoPopover = ({
icon: ,
selected: node?.data?.level === 1,
onClick: (type: BlockType, isSelected: boolean) => {
- turnIntoHeading(1, isSelected);
+ void turnIntoHeading(1, isSelected);
},
},
{
@@ -67,7 +67,7 @@ const TurnIntoPopover = ({
icon: ,
selected: node?.data?.level === 2,
onClick: (type: BlockType, isSelected: boolean) => {
- turnIntoHeading(2, isSelected);
+ void turnIntoHeading(2, isSelected);
},
},
{
@@ -77,7 +77,7 @@ const TurnIntoPopover = ({
icon: ,
selected: node?.data?.level === 3,
onClick: (type: BlockType, isSelected: boolean) => {
- turnIntoHeading(3, isSelected);
+ void turnIntoHeading(3, isSelected);
},
},
{
@@ -143,7 +143,7 @@ const TurnIntoPopover = ({
(option: Option) => {
const isSelected = getSelected(option);
- option.onClick ? option.onClick(option.type, isSelected) : turnIntoBlock(option.type, isSelected);
+ option.onClick ? option.onClick(option.type, isSelected) : void turnIntoBlock(option.type, isSelected);
onOk?.();
},
[onOk, getSelected, turnIntoBlock]
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts
index f9f3579963..3a101cac22 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UndoHooks/useUndoRedo.ts
@@ -6,25 +6,26 @@ import { useSubscribeDocument } from '$app/components/document/_shared/Subscribe
export function useUndoRedo(container: HTMLDivElement) {
const { controller } = useSubscribeDocument();
- const onUndo = useCallback(() => {
+ const onUndo = useCallback(async () => {
if (!controller) return;
- controller.undo();
+ await controller.undo();
}, [controller]);
- const onRedo = useCallback(() => {
+ const onRedo = useCallback(async () => {
if (!controller) return;
- controller.redo();
+ await controller.redo();
}, [controller]);
const handleKeyDownCapture = useCallback(
- (e: KeyboardEvent) => {
+ async (e: KeyboardEvent) => {
if (isHotkey(Keyboard.keys.UNDO, e)) {
e.stopPropagation();
- onUndo();
+ await onUndo();
}
+
if (isHotkey(Keyboard.keys.REDO, e)) {
e.stopPropagation();
- onRedo();
+ await onRedo();
}
},
[onRedo, onUndo]
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/ImageEditPopover.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/ImageEditPopover.tsx
index af31ae70c5..e341563d57 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/ImageEditPopover.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/ImageEditPopover.tsx
@@ -1,7 +1,6 @@
import React from 'react';
import Popover, { PopoverProps } from '@mui/material/Popover';
import ImageEdit from './ImageEdit';
-import { PopoverOrigin } from '@mui/material/Popover/Popover';
interface Props extends PopoverProps {
onSubmitUrl: (url: string) => void;
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/TabPanel.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/TabPanel.tsx
index 1f0f6ab4ef..9356a246aa 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/TabPanel.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/TabPanel.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+
export enum TAB_KEYS {
UPLOAD = 'upload',
LINK = 'link',
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/UploadImage.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/UploadImage.tsx
index ecb14d7d2f..5990f5b5b9 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/UploadImage.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/UploadImage/UploadImage.tsx
@@ -42,6 +42,7 @@ function UploadImage({ onChange }: UploadImageProps) {
duration: 3000,
type: 'error',
});
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [error]);
const handleUpload = useCallback(
@@ -74,7 +75,7 @@ function UploadImage({ onChange }: UploadImageProps) {
if (!files || files.length === 0) return;
const file = files[0];
- handleUpload(file);
+ void handleUpload(file);
},
[handleUpload]
);
@@ -87,7 +88,7 @@ function UploadImage({ onChange }: UploadImageProps) {
if (!files || files.length === 0) return;
const file = files[0];
- handleUpload(file);
+ void handleUpload(file);
},
[handleUpload]
);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/useBindArrowKey.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/useBindArrowKey.ts
index 8d2ac27796..29aebe52e9 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/useBindArrowKey.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/useBindArrowKey.ts
@@ -83,6 +83,7 @@ export const useBindArrowKey = ({
} else {
document.removeEventListener('keydown', handleArrowKey, true);
}
+
return () => {
document.removeEventListener('keydown', handleArrowKey, true);
};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/usePanelSearchText.ts b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/usePanelSearchText.ts
index 245041f702..034919e838 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/usePanelSearchText.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/usePanelSearchText.ts
@@ -25,9 +25,11 @@ export function useSubscribePanelSearchText({ blockId, open }: { blockId: string
beforeOpenDeltaRef.current = [];
return;
}
+
if (beforeOpenDeltaRef.current.length > 0) return;
const delta = new Delta(JSON.parse(deltaStr || "{}"));
+
beforeOpenDeltaRef.current = delta.ops;
handleSearch(delta);
}, [deltaStr, handleSearch, open]);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/error/Error.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/error/Error.hooks.ts
index 2da03c5f5c..ceaa5a51a0 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/error/Error.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/error/Error.hooks.ts
@@ -1,6 +1,6 @@
-import { useAppDispatch, useAppSelector } from '../../stores/store';
-import { errorActions } from '../../stores/reducers/error/slice';
-import { useEffect, useState } from 'react';
+import { useAppDispatch, useAppSelector } from '$app/stores/store';
+import { errorActions } from '$app_reducers/error/slice';
+import { useCallback, useEffect, useState } from 'react';
export const useError = (e: Error) => {
const dispatch = useAppDispatch();
@@ -13,15 +13,18 @@ export const useError = (e: Error) => {
setErrorMessage(error.message);
}, [error]);
+ const showError = useCallback(
+ (msg: string) => {
+ dispatch(errorActions.showError(msg));
+ },
+ [dispatch]
+ );
+
useEffect(() => {
if (e) {
showError(e.message);
}
- }, [e]);
-
- const showError = (msg: string) => {
- dispatch(errorActions.showError(msg));
- };
+ }, [e, showError]);
const hideError = () => {
dispatch(errorActions.hideError());
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
index 727f831a81..51ffd11186 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
@@ -2,6 +2,7 @@ import { RowInfo } from '@/appflowy_app/stores/effects/database/row/row_cache';
export const GridTableCount = ({ rows }: { rows: readonly RowInfo[] }) => {
const count = rows.length;
+
return (
Count : {count}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableHeader/GridTableHeaderItem.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableHeader/GridTableHeaderItem.tsx
index c4b85be45b..194709d40c 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableHeader/GridTableHeaderItem.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableHeader/GridTableHeaderItem.tsx
@@ -53,7 +53,8 @@ export const GridTableHeaderItem = ({
if (newSizeX >= MIN_COLUMN_WIDTH) {
dispatch(databaseActions.changeWidth({ fieldId: field.fieldId, width: newSizeX }));
}
- }, [newSizeX]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [newSizeX, dispatch]);
const changeFieldType = async (newType: FieldType) => {
if (!editingField) return;
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Breadcrumb/Breadcrumb.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Breadcrumb/Breadcrumb.hooks.ts
index 2288657d7b..7063cea877 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Breadcrumb/Breadcrumb.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Breadcrumb/Breadcrumb.hooks.ts
@@ -1,9 +1,9 @@
-import { useAppSelector } from "$app/stores/store";
+import { useAppSelector } from '$app/stores/store';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useParams, useLocation } from 'react-router-dom';
import { Page } from '$app_reducers/pages/slice';
import { useTranslation } from 'react-i18next';
-import { PageController } from "$app/stores/effects/workspace/page/page_controller";
+import { PageController } from '$app/stores/effects/workspace/page/page_controller';
export function useLoadExpandedPages() {
const { t } = useTranslation();
@@ -25,6 +25,7 @@ export function useLoadExpandedPages() {
async (pageId: string) => {
let page = pageMap[pageId];
const controller = new PageController(pageId);
+
if (!page) {
try {
page = await controller.getPage();
@@ -36,22 +37,22 @@ export function useLoadExpandedPages() {
return;
}
}
- setPagePath(prev => {
- return [
- page,
- ...prev
- ]
+
+ setPagePath((prev) => {
+ return [page, ...prev];
});
await loadPagePath(page.parentId);
-
- }, [pageMap]);
+ },
+ [pageMap]
+ );
useEffect(() => {
setPagePath([]);
if (!currentPageId) {
return;
}
- loadPagePath(currentPageId);
+
+ void loadPagePath(currentPageId);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentPageId]);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NestedPage/NestedPage.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NestedPage/NestedPage.hooks.ts
index 7acd565087..428c77193b 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NestedPage/NestedPage.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NestedPage/NestedPage.hooks.ts
@@ -36,30 +36,30 @@ export function useLoadChildPages(pageId: string) {
[dispatch]
);
+ const loadPageChildren = useCallback(
+ async (pageId: string) => {
+ const childPages = await controller.getChildPages();
- const loadPageChildren = useCallback(async (pageId: string) => {
- const childPages = await controller.getChildPages();
-
- dispatch(
- pagesActions.addChildPages({
- id: pageId,
- childPages,
- })
- );
-
- }, [controller, dispatch]);
-
+ dispatch(
+ pagesActions.addChildPages({
+ id: pageId,
+ childPages,
+ })
+ );
+ },
+ [controller, dispatch]
+ );
useEffect(() => {
void loadPageChildren(pageId);
}, [loadPageChildren, pageId]);
useEffect(() => {
- controller.subscribe({
+ void controller.subscribe({
onPageChanged,
});
return () => {
- controller.dispose();
+ void controller.dispose();
};
}, [controller, onPageChanged]);
@@ -88,7 +88,7 @@ export function usePageActions(pageId: string) {
async (layout: ViewLayoutPB) => {
const newViewId = await controller.createPage({
layout,
- name: ""
+ name: '',
});
dispatch(pagesActions.expandPage(pageId));
@@ -116,7 +116,7 @@ export function usePageActions(pageId: string) {
useEffect(() => {
return () => {
- controller.dispose();
+ void controller.dispose();
};
}, [controller]);
@@ -134,4 +134,3 @@ export function useSelectedPage(pageId: string) {
return id === pageId;
}
-
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Share/Share.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Share/Share.hooks.ts
index 8cce47a2ab..b281706848 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Share/Share.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Share/Share.hooks.ts
@@ -1,4 +1,4 @@
-import { useLocation, useParams } from 'react-router-dom';
+import { useParams } from 'react-router-dom';
export function useShareConfig() {
const params = useParams();
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreButton.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreButton.tsx
index bf2d48d827..ca104218ab 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreButton.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreButton.tsx
@@ -1,8 +1,7 @@
-import React, { useCallback, useMemo } from 'react';
+import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { Drawer, IconButton } from '@mui/material';
import { Details2Svg } from '$app/components/_shared/svg/Details2Svg';
-import { LogoutOutlined } from '@mui/icons-material';
import Tooltip from '@mui/material/Tooltip';
import MoreOptions from '$app/components/layout/TopBar/MoreOptions';
import { useMoreOptionsConfig } from '$app/components/layout/TopBar/MoreOptions.hooks';
@@ -19,7 +18,7 @@ function MoreButton() {
return (
<>
- toggleDrawer(true)} className={'h-8 w-8 text-icon-primary'}>
+ toggleDrawer(true)} className={'h-8 w-8 text-icon-primary'}>
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.hooks.ts
index 57b10a4fed..63f1173885 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.hooks.ts
@@ -4,7 +4,8 @@ import { useMemo } from 'react';
export function useMoreOptionsConfig() {
const location = useLocation();
- const { type, pageType, id } = useMemo(() => {
+ const { type, pageType } = useMemo(() => {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, type, pageType, id] = location.pathname.split('/');
return {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.tsx
index 97a48128f7..28f2b46759 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/TopBar/MoreOptions.tsx
@@ -1,12 +1,8 @@
import React from 'react';
-import { useTranslation } from 'react-i18next';
import FontSizeConfig from '$app/components/layout/TopBar/FontSizeConfig';
-import { Divider } from '@mui/material';
-import { useLocation } from 'react-router-dom';
import { useMoreOptionsConfig } from '$app/components/layout/TopBar/MoreOptions.hooks';
function MoreOptions() {
- const { t } = useTranslation();
const { showStyleOptions } = useMoreOptionsConfig();
return {showStyleOptions && }
;
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/LanguageSetting.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/LanguageSetting.tsx
index b2395d7645..bcd171f4c0 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/LanguageSetting.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/LanguageSetting.tsx
@@ -56,7 +56,7 @@ function LanguageSetting({
onChange({
language,
});
- i18n.changeLanguage(language);
+ void i18n.changeLanguage(language);
}}
>
{languages.map((option) => (
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/index.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/index.tsx
index 5b4ec98294..9fa5beabcf 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/index.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/UserSetting/index.tsx
@@ -30,7 +30,7 @@ function UserSettings({ open, onClose }: { open: boolean; onClose: () => void })
if (userSettingController) {
const language = newSetting.language || 'en';
- userSettingController.setAppearanceSetting({
+ void userSettingController.setAppearanceSetting({
theme: newSetting.theme || Theme.Default,
theme_mode: newSetting.themeMode || ThemeModePB.Light,
locale: {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/WorkspaceManager/NewPageButton.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/WorkspaceManager/NewPageButton.tsx
index e2346fa7a9..ad405024a1 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/WorkspaceManager/NewPageButton.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/WorkspaceManager/NewPageButton.tsx
@@ -12,7 +12,7 @@ function NewPageButton({ workspaceId }: { workspaceId: string }) {
useEffect(() => {
return () => {
- controller.dispose();
+ void controller.dispose();
};
}, [controller]);
@@ -21,7 +21,7 @@ function NewPageButton({ workspaceId }: { workspaceId: string }) {