1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+helm-releases/release-details/release-route-parameters.injectable.ts
Sebastian Malton 645fb23d05 Fix rerendering of KubeObject views every 30s
- 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>
2022-02-02 16:59:20 -05:00

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;