feat: Add on mode init hook (#3882)

This commit is contained in:
Igor Octaviano authored and GitHub committed 2024-01-08 14:12:26 -05:00
1 parent 5a1cb842f0
commit f58725ce40
2 files changed
+19

No files matched your search

+10
View File
@@ -124,6 +124,15 @@ export default function ModeRoute({
const params = useParams(); const params = useParams();
// The URL's query search parameters where the keys casing is maintained // The URL's query search parameters where the keys casing is maintained
const query = useSearchParams(); const query = useSearchParams();
mode?.onModeInit?.({
servicesManager,
extensionManager,
commandsManager,
appConfig,
query,
});
// The URL's query search parameters where the keys are all lower case. // The URL's query search parameters where the keys are all lower case.
const lowerCaseSearchParams = useSearchParams({ lowerCaseKeys: true }); const lowerCaseSearchParams = useSearchParams({ lowerCaseKeys: true });
@@ -341,6 +350,7 @@ export default function ModeRoute({
servicesManager, servicesManager,
extensionManager, extensionManager,
commandsManager, commandsManager,
appConfig,
}); });
/** /**
@@ -9,9 +9,18 @@ sidebar_label: Lifecycle Hooks
Currently, there are two hooks that are called for modes: Currently, there are two hooks that are called for modes:
- onModeInit
- onModeEnter - onModeEnter
- onModeExit - onModeExit
## onModeInit
This hook gets run before the defined route has been entered by the mode. This
hook can be used for initialization before the first render.
This is called before `onModeEnter` calls. This allows modes to add or activate their own
data sources and configuration before entering the mode (pre registrations).
## onModeEnter ## onModeEnter
This hook gets run after the defined route has been entered by the mode. This This hook gets run after the defined route has been entered by the mode. This