mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Prevent creation of dynamic components where withInjectables use type parameters to make React not re-mount because of dynamic components being different (#4808)
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
6ebfd76644
commit
09824a6e01
3 files changed
+44
-42
No files matched your search
@@ -138,23 +138,25 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
}
|
||||
}
|
||||
|
||||
const InjectedKubeObjectListLayout = withInjectables<
|
||||
Dependencies,
|
||||
KubeObjectListLayoutProps<KubeObject>
|
||||
>(
|
||||
NonInjectedKubeObjectListLayout,
|
||||
|
||||
{
|
||||
getProps: (di, props) => ({
|
||||
clusterFrameContext: di.inject(clusterFrameContextInjectable),
|
||||
subscribeToStores: di.inject(kubeWatchApiInjectable).subscribeStores,
|
||||
...props,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
export function KubeObjectListLayout<K extends KubeObject>(
|
||||
props: KubeObjectListLayoutProps<K>,
|
||||
) {
|
||||
const InjectedKubeObjectListLayout = withInjectables<
|
||||
Dependencies,
|
||||
KubeObjectListLayoutProps<K>
|
||||
>(
|
||||
NonInjectedKubeObjectListLayout,
|
||||
|
||||
{
|
||||
getProps: (di, props) => ({
|
||||
clusterFrameContext: di.inject(clusterFrameContextInjectable),
|
||||
subscribeToStores: di.inject(kubeWatchApiInjectable).subscribeStores,
|
||||
...props,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
return <InjectedKubeObjectListLayout {...props} />;
|
||||
}
|
||||
Reference in new issue
Block a user