react-arborist icon indicating copy to clipboard operation
react-arborist copied to clipboard

Internal ID mapping in case of custom idAccessor

Open aliaksandr-yanchuk opened this issue 2 years ago • 2 comments

Hi and thanks for a great tree component, really awesome!

I've noticed one thing, when in case of custom idAccessor (e.g. uid instead of id), internal logic is still relying on "id" in some places. For example drag and drop reorder/move works through useSimpleTree and there goes direct mapping through id, without check for idAccessor property.

Best regards, Alexander Yanchuk

aliaksandr-yanchuk avatar Jan 12 '23 14:01 aliaksandr-yanchuk

You are correct. That is a gap that needs closing. useSimpleTree should accept the accessor arguments. The useSimpleTree hook is not really documented as public API, but several people have found it and found this limitation. I'd welcome a PR if you're up for it. It shouldn't be too difficult.

jameskerr avatar Jan 12 '23 18:01 jameskerr

Thanks, schedule is a bit tight now, but I'll try

aliaksandr-yanchuk avatar Jan 14 '23 02:01 aliaksandr-yanchuk