Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: replace noop function (#2744)

Himself65af6f431c152f
diff --git a/apps/electron/scripts/plugins/build-plugins.mjs b/apps/electron/scripts/plugins/build-plugins.mjs
index 5a331d7a0a..60ea6138ee 100755
--- a/apps/electron/scripts/plugins/build-plugins.mjs
+++ b/apps/electron/scripts/plugins/build-plugins.mjs
@@ -5,5 +5,5 @@ import { definePluginServerConfig } from './utils.mjs';
await build({
...definePluginServerConfig('bookmark-block'),
- external: ['cheerio', 'electron', 'puppeteer'],
+ external: ['cheerio', 'electron', 'puppeteer', 'foxact'],
});
diff --git a/apps/electron/scripts/plugins/dev-plugins.mjs b/apps/electron/scripts/plugins/dev-plugins.mjs
index 2b158636b3..6f4165d1dc 100755
--- a/apps/electron/scripts/plugins/dev-plugins.mjs
+++ b/apps/electron/scripts/plugins/dev-plugins.mjs
@@ -5,7 +5,7 @@ import { definePluginServerConfig } from './utils.mjs';
const plugin = await context({
...definePluginServerConfig('bookmark-block'),
- external: ['cheerio', 'electron', 'puppeteer'],
+ external: ['cheerio', 'electron', 'puppeteer', 'foxact'],
});
await plugin.watch();
diff --git a/packages/component/src/components/app-sidebar/app-updater-button/index.jotai.ts b/packages/component/src/components/app-sidebar/app-updater-button/index.jotai.ts
index 9f33116f75..eb89a2eae2 100644
--- a/packages/component/src/components/app-sidebar/app-updater-button/index.jotai.ts
+++ b/packages/component/src/components/app-sidebar/app-updater-button/index.jotai.ts
@@ -24,7 +24,7 @@ function rpcToObservable<
onSubscribe?.();
if (typeof window === 'undefined' || !env.isDesktop || !event) {
subscriber.complete();
- return () => {};
+ return;
}
handler?.()
.then(t => {
diff --git a/packages/component/src/components/app-sidebar/spolight/index.tsx b/packages/component/src/components/app-sidebar/spolight/index.tsx
index 5e20f0a5b3..536f992d7e 100644
--- a/packages/component/src/components/app-sidebar/spolight/index.tsx
+++ b/packages/component/src/components/app-sidebar/spolight/index.tsx
@@ -30,7 +30,7 @@ function useMouseOffset() {
el.removeEventListener('mouseleave', onMouseLeave);
};
}
- return () => {};
+ return;
}, []);
return [offset, outside, ref] as const;
diff --git a/packages/component/src/components/block-suite-editor/index.tsx b/packages/component/src/components/block-suite-editor/index.tsx
index 1aee076d3c..e8c9b6fde2 100644
--- a/packages/component/src/components/block-suite-editor/index.tsx
+++ b/packages/component/src/components/block-suite-editor/index.tsx
@@ -80,7 +80,7 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
.forEach(dispose => dispose());
};
}
- return () => {};
+ return;
}, [editor, editor.page, page, onLoad]);
const ref = useRef<HTMLDivElement>(null);
diff --git a/packages/component/src/components/image-preview-modal/index.jotai.ts b/packages/component/src/components/image-preview-modal/index.jotai.ts
index de04be0408..b1d113b281 100644
--- a/packages/component/src/components/image-preview-modal/index.jotai.ts
+++ b/packages/component/src/components/image-preview-modal/index.jotai.ts
@@ -13,5 +13,5 @@ previewBlockIdAtom.onMount = set => {
window.removeEventListener('affine.embed-block-db-click', callback);
};
}
- return () => {};
+ return;
};
diff --git a/packages/component/src/components/notification-center/index.tsx b/packages/component/src/components/notification-center/index.tsx
index d34250b552..cd36f015ca 100644
--- a/packages/component/src/components/notification-center/index.tsx
+++ b/packages/component/src/components/notification-center/index.tsx
@@ -201,7 +201,7 @@ function NotificationCard(props: NotificationCardProps): ReactElement {
h.filter(height => height.notificationKey !== notification.key)
);
}
- return () => {};
+ return;
}, [notification.key, setHeights]);
return (
<Toast.Root
diff --git a/packages/hooks/src/use-block-suite-workspace-avatar-url.ts b/packages/hooks/src/use-block-suite-workspace-avatar-url.ts
index 799fd67b01..db56dd3652 100644
--- a/packages/hooks/src/use-block-suite-workspace-avatar-url.ts
+++ b/packages/hooks/src/use-block-suite-workspace-avatar-url.ts
@@ -43,7 +43,7 @@ export function useBlockSuiteWorkspaceAvatarUrl(
dispose.dispose();
};
}
- return () => {};
+ return;
}, [blockSuiteWorkspace]);
return [avatar ?? null, setAvatar] as const;
}
diff --git a/packages/workspace/src/atom.ts b/packages/workspace/src/atom.ts
index 4a5e4dd87f..147aa67645 100644
--- a/packages/workspace/src/atom.ts
+++ b/packages/workspace/src/atom.ts
@@ -48,7 +48,7 @@ rootCurrentWorkspaceIdAtom.onMount = set => {
Router.events.off('routeChangeStart', callback);
};
}
- return () => {};
+ return;
};
export const rootCurrentPageIdAtom = atom<string | null>(null);
@@ -69,7 +69,7 @@ rootCurrentPageIdAtom.onMount = set => {
Router.events.off('routeChangeStart', callback);
};
}
- return () => {};
+ return;
};
// current editor atom, each app should have only one editor in the same time
diff --git a/plugins/bookmark-block/package.json b/plugins/bookmark-block/package.json
index 06165365f0..2b0942608c 100644
--- a/plugins/bookmark-block/package.json
+++ b/plugins/bookmark-block/package.json
@@ -9,6 +9,7 @@
},
"dependencies": {
"@toeverything/plugin-infra": "workspace:*",
+ "foxact": "^0.2.7",
"link-preview-js": "^3.0.4"
},
"devDependencies": {
diff --git a/plugins/bookmark-block/src/blocksuite/index.tsx b/plugins/bookmark-block/src/blocksuite/index.tsx
index a7e04a9d47..38c0aaefad 100644
--- a/plugins/bookmark-block/src/blocksuite/index.tsx
+++ b/plugins/bookmark-block/src/blocksuite/index.tsx
@@ -1,4 +1,5 @@
import type { PluginBlockSuiteAdapter } from '@toeverything/plugin-infra/type';
+import { noop } from 'foxact/noop';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
@@ -23,7 +24,7 @@ export default {
div.remove();
};
} else {
- return () => {};
+ return noop;
}
},
} satisfies Partial<PluginBlockSuiteAdapter>;
diff --git a/yarn.lock b/yarn.lock
index af76f28daf..1d1f8a9584 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -35,6 +35,7 @@ __metadata:
resolution: "@affine/bookmark-block@workspace:plugins/bookmark-block"
dependencies:
"@toeverything/plugin-infra": "workspace:*"
+ foxact: ^0.2.7
link-preview-js: ^3.0.4
react: 18.3.0-canary-16d053d59-20230506
react-dom: 18.3.0-canary-16d053d59-20230506
@@ -12573,7 +12574,7 @@ __metadata:
languageName: node
linkType: hard
-"client-only@npm:0.0.1":
+"client-only@npm:0.0.1, client-only@npm:^0.0.1":
version: 0.0.1
resolution: "client-only@npm:0.0.1"
checksum: 0c16bf660dadb90610553c1d8946a7fdfb81d624adea073b8440b7d795d5b5b08beb3c950c6a2cf16279365a3265158a236876d92bce16423c485c322d7dfaf8
@@ -16145,6 +16146,21 @@ __metadata:
languageName: node
linkType: hard
+"foxact@npm:^0.2.7":
+ version: 0.2.7
+ resolution: "foxact@npm:0.2.7"
+ dependencies:
+ client-only: ^0.0.1
+ server-only: ^0.0.1
+ peerDependencies:
+ react: "*"
+ peerDependenciesMeta:
+ react:
+ optional: true
+ checksum: d60a292461a80e9c23137b8cf054841e3d99366e465c6b32bf81803821bedbe7c2ce374c5264921a5eb3df7ed3c7cb4d95db40e253bc745c2eb226c38ecd116b
+ languageName: node
+ linkType: hard
+
"fractional-indexing@npm:^3.2.0":
version: 3.2.0
resolution: "fractional-indexing@npm:3.2.0"
@@ -24703,6 +24719,13 @@ __metadata:
languageName: node
linkType: hard
+"server-only@npm:^0.0.1":
+ version: 0.0.1
+ resolution: "server-only@npm:0.0.1"
+ checksum: c432348956641ea3f460af8dc3765f3a1bdbcf7a1e0205b0756d868e6e6fe8934cdee6bff68401a1dd49ba4a831c75916517a877446d54b334f7de36fa273e53
+ languageName: node
+ linkType: hard
+
"set-blocking@npm:^2.0.0":
version: 2.0.0
resolution: "set-blocking@npm:2.0.0"