-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: optimize async route meta solution (#1974)
* refactor: optimize async route meta solution * refactor: simplify markdown loader rules * refactor: correct async tab meta load logic * refactor: page suspense add fallback
- Loading branch information
1 parent
b962cf9
commit 5ffeaa4
Showing
33 changed files
with
486 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
module.exports = { | ||
extends: require.resolve('@umijs/lint/dist/config/eslint'), | ||
rules: { | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ ignoreRestSiblings: true }, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { PICKED_PKG_FIELDS } from '@/constants'; | ||
import type { AtomComponentAsset } from 'dumi-assets-types'; | ||
import { createContext, useContext } from 'react'; | ||
import type { IDemoData, ILocalesConfig, IThemeConfig } from './types'; | ||
|
||
interface ISiteContext { | ||
pkg: Partial<Record<keyof typeof PICKED_PKG_FIELDS, any>>; | ||
historyType: 'browser' | 'hash' | 'memory'; | ||
entryExports: Record<string, any>; | ||
demos: Record<string, IDemoData>; | ||
components: Record<string, AtomComponentAsset>; | ||
locales: ILocalesConfig; | ||
themeConfig: IThemeConfig; | ||
hostname?: string; | ||
loading: boolean; | ||
setLoading: (status: boolean) => void; | ||
/** | ||
* private field, do not use it in your code | ||
*/ | ||
_2_level_nav_available: boolean; | ||
} | ||
|
||
export const SiteContext = createContext<ISiteContext>({ | ||
pkg: {}, | ||
historyType: 'browser', | ||
entryExports: {}, | ||
demos: {}, | ||
components: {}, | ||
locales: [], | ||
themeConfig: {} as IThemeConfig, | ||
loading: false, | ||
setLoading: () => {}, | ||
_2_level_nav_available: true, | ||
}); | ||
|
||
export const useSiteData = () => { | ||
return useContext(SiteContext); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.