fix: replace noop function (#2744)

This commit is contained in:
Himself65
2023-06-09 16:00:44 +08:00
committed by GitHub
parent 01ae21e1fa
commit af6f431c15
12 changed files with 37 additions and 12 deletions
@@ -5,5 +5,5 @@ import { definePluginServerConfig } from './utils.mjs';
await build({
...definePluginServerConfig('bookmark-block'),
external: ['cheerio', 'electron', 'puppeteer'],
external: ['cheerio', 'electron', 'puppeteer', 'foxact'],
});
@@ -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();
@@ -24,7 +24,7 @@ function rpcToObservable<
onSubscribe?.();
if (typeof window === 'undefined' || !env.isDesktop || !event) {
subscriber.complete();
return () => {};
return;
}
handler?.()
.then(t => {
@@ -30,7 +30,7 @@ function useMouseOffset() {
el.removeEventListener('mouseleave', onMouseLeave);
};
}
return () => {};
return;
}, []);
return [offset, outside, ref] as const;
@@ -80,7 +80,7 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
.forEach(dispose => dispose());
};
}
return () => {};
return;
}, [editor, editor.page, page, onLoad]);
const ref = useRef<HTMLDivElement>(null);
@@ -13,5 +13,5 @@ previewBlockIdAtom.onMount = set => {
window.removeEventListener('affine.embed-block-db-click', callback);
};
}
return () => {};
return;
};
@@ -201,7 +201,7 @@ function NotificationCard(props: NotificationCardProps): ReactElement {
h.filter(height => height.notificationKey !== notification.key)
);
}
return () => {};
return;
}, [notification.key, setHeights]);
return (
<Toast.Root
@@ -43,7 +43,7 @@ export function useBlockSuiteWorkspaceAvatarUrl(
dispose.dispose();
};
}
return () => {};
return;
}, [blockSuiteWorkspace]);
return [avatar ?? null, setAvatar] as const;
}
+2 -2
View File
@@ -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
+1
View File
@@ -9,6 +9,7 @@
},
"dependencies": {
"@toeverything/plugin-infra": "workspace:*",
"foxact": "^0.2.7",
"link-preview-js": "^3.0.4"
},
"devDependencies": {
@@ -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>;
+24 -1
View File
@@ -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"