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:
Janne SavolainenandMikko Aspiala authored and GitHub committed 2022-02-03 13:26:14 +02:00
1 parent 6ebfd76644
commit 09824a6e01
3 files changed
+44 -42

No files matched your search

+11 -11
View File
@@ -246,18 +246,18 @@ class NonInjectedTable<Item> extends React.Component<TableProps<Item> & Dependen
}
}
const InjectedTable = withInjectables<Dependencies, TableProps<any>>(
NonInjectedTable,
{
getProps: (di, props) => ({
model: di.inject(tableModelInjectable),
...props,
}),
},
);
export function Table<Item>(props: TableProps<Item>) {
const InjectedTable = withInjectables<Dependencies, TableProps<Item>>(
NonInjectedTable,
{
getProps: (di, props) => ({
model: di.inject(tableModelInjectable),
...props,
}),
},
);
return <InjectedTable {...props} />;
}