Closed mshabarov closed 2 years ago
The solution described above triggers a circular calls between keyMapper
of HierarchicalDataCommunicator
and uniqueKeyProvider
of TreeGrid
causing StackOverflow
.
Additionally, HDC
and TreeGrid
depends on each other in a following way:
HDC
instance TreeGrid
has to give it a uniqueKeyProviderSupplier
keyMapper
stored in HDC
, uniqueKeyProvider
of TreeGrid
needs an instance of HDC
.
This raises a "chicken and egg" problem.Possible solution for this is to pass a holder object to the HDC
instead of plain uniqueKeyProviderSupplier
, which would contain the key provider supplier (the same as previously) and a consumer for keyMapper
. Then HDC
could call this consumer and transfer the original keyMapper
(without key provider fallback) to the TreeGrid
.
This solution would require a deprecation of existing HDC
CTOR and adding a new one with this holder object described above in place of key provider supplier. TreeGrid
would then use this new CTOR and get the existing keyMapper
.
We would probably need to collaborate with the Flow team to check if we can enhance the HDC
to preserve the keys that are still in use.
Flow and flow-components have a patch already, so let's close this ticket.
Describe your motivation
TreeGrid
defines the default unique key provider for it's items, as follows:This default provider basically uses the same approach as a regular key mapper: integer counter as a source for a keys. But it adds an extra collection and moreover, this collection is never cleaned up.
Describe the solution you'd like
Use
KeyMapper
class as a default fallback for unique key provider:DataCommunicator
'sKeyMapper
(not to the wrapperuniqueKeyMapper
from 2., but to the one original one).HierarchicalDataCommunicator
delegates to key provider it it's not empty:Describe alternatives you've considered
No response
Additional context
No response