mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- This was being caused by the Cluster.refreshAllowedResources() on main - Using comparer.deepEquals on the set of allowedResources dependency means that changes are not propogated unless required Signed-off-by: Sebastian Malton <sebastian@malton.name>
32 lines
1008 B
TypeScript
32 lines
1008 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
|
import { computed } from "mobx";
|
|
import { matchPath } from "react-router";
|
|
import observableHistoryInjectable from "../../../navigation/observable-history.injectable";
|
|
import { releaseRoute, ReleaseRouteParams } from "../../../../common/routes";
|
|
|
|
const releaseRouteParametersInjectable = getInjectable({
|
|
instantiate: (di) => {
|
|
const observableHistory = di.inject(observableHistoryInjectable);
|
|
|
|
return computed(() => {
|
|
const releasePathParameters = matchPath<ReleaseRouteParams>(observableHistory.location.pathname, {
|
|
path: releaseRoute.path,
|
|
});
|
|
|
|
if (!releasePathParameters) {
|
|
return {};
|
|
}
|
|
|
|
return releasePathParameters.params;
|
|
});
|
|
},
|
|
|
|
lifecycle: lifecycleEnum.singleton,
|
|
});
|
|
|
|
export default releaseRouteParametersInjectable;
|