mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: add eslint-plugin-sonarjs and rules (#2767)
This commit is contained in:
@@ -109,7 +109,7 @@ const EditorWrapper = memo(function EditorWrapper({
|
||||
);
|
||||
const disposes = uiDecorators.map(ui => ui(editor));
|
||||
return () => {
|
||||
disposes.map(fn => fn());
|
||||
disposes.forEach(fn => fn());
|
||||
dispose();
|
||||
};
|
||||
},
|
||||
|
||||
@@ -80,15 +80,10 @@ export function WorkspaceHeader({
|
||||
{t['Workspace Settings']()}
|
||||
</WorkspaceTitle>
|
||||
);
|
||||
} else if (currentEntry.subPath === WorkspaceSubPath.SHARED) {
|
||||
return (
|
||||
<WorkspaceModeFilterTab
|
||||
workspace={currentWorkspace}
|
||||
currentPage={null}
|
||||
isPublic={false}
|
||||
/>
|
||||
);
|
||||
} else if (currentEntry.subPath === WorkspaceSubPath.TRASH) {
|
||||
} else if (
|
||||
currentEntry.subPath === WorkspaceSubPath.SHARED ||
|
||||
currentEntry.subPath === WorkspaceSubPath.TRASH
|
||||
) {
|
||||
return (
|
||||
<WorkspaceModeFilterTab
|
||||
workspace={currentWorkspace}
|
||||
|
||||
@@ -39,8 +39,9 @@ function useTabRouterSync(
|
||||
? router.query.currentTab
|
||||
: null;
|
||||
if (
|
||||
queryCurrentTab !== null &&
|
||||
settingPanelValues.indexOf(queryCurrentTab as SettingPanel) === -1
|
||||
(queryCurrentTab !== null &&
|
||||
settingPanelValues.indexOf(queryCurrentTab as SettingPanel) === -1) ||
|
||||
settingPanelValues.indexOf(currentTab as SettingPanel) === -1
|
||||
) {
|
||||
setCurrentTab(settingPanel.General);
|
||||
router
|
||||
@@ -52,17 +53,6 @@ function useTabRouterSync(
|
||||
},
|
||||
})
|
||||
.catch(console.error);
|
||||
} else if (settingPanelValues.indexOf(currentTab as SettingPanel) === -1) {
|
||||
setCurrentTab(settingPanel.General);
|
||||
router
|
||||
.replace({
|
||||
pathname: router.pathname,
|
||||
query: {
|
||||
...router.query,
|
||||
currentTab: settingPanel.General,
|
||||
},
|
||||
})
|
||||
.catch(console.error);
|
||||
} else if (queryCurrentTab !== currentTab) {
|
||||
router
|
||||
.replace({
|
||||
@@ -109,11 +99,11 @@ const SettingPage: NextPageWithLayout = () => {
|
||||
return helper.deleteWorkspace(workspaceId);
|
||||
}, [currentWorkspace, helper]);
|
||||
const onTransformWorkspace = useOnTransformWorkspace();
|
||||
if (!router.isReady) {
|
||||
return <PageLoading />;
|
||||
} else if (currentWorkspace === null) {
|
||||
return <PageLoading />;
|
||||
} else if (settingPanelValues.indexOf(currentTab as SettingPanel) === -1) {
|
||||
if (
|
||||
!router.isReady ||
|
||||
currentWorkspace === null ||
|
||||
settingPanelValues.indexOf(currentTab as SettingPanel) === -1
|
||||
) {
|
||||
return <PageLoading />;
|
||||
}
|
||||
const { SettingsDetail, Header } = getUIAdapter(currentWorkspace.flavour);
|
||||
|
||||
@@ -31,9 +31,7 @@ const TrashPage: NextPageWithLayout = () => {
|
||||
},
|
||||
[currentWorkspace, jumpToPage]
|
||||
);
|
||||
if (!router.isReady) {
|
||||
return <PageLoading />;
|
||||
} else if (currentWorkspace === null) {
|
||||
if (!router.isReady || currentWorkspace === null) {
|
||||
return <PageLoading />;
|
||||
}
|
||||
// todo(himself65): refactor to plugin
|
||||
|
||||
Reference in New Issue
Block a user