[WIP] attempt to fix break since dcc-2996

Hey, I had a look at the code for issues #1096 and #1026 and did an attempt to resolve the issue. I'm not sure if this is the way to fix this and sending this PR to kickstart any work/discussion to get to a final solution. Please review and share your thought.

ps. This only fixes the Tree extension.