lukasbach / react-complex-tree

Unopinionated Accessible Tree Component with Multi-Select and Drag-And-Drop
https://rct.lukasbach.com
MIT License
953 stars 77 forks source link

renaming from context of custom renderer is not working #83

Closed Nishchit14 closed 1 year ago

Nishchit14 commented 2 years ago

Describe the bug I am using a custom renderer for items and It has a menu dropdown, from where the user can click on the rename option to rename the item, but the context.startRenaming method doesn't work at all.

here is the renderer

renderItem: ({ item, depth, children, title, context, arrow }) => {

    let _startRenaming = ()=> {

      console.log(context, "... _startRenaming")
      context.startRenamingItem(); // <= this method is empty and make no effect
    }
}

also, I see that this function is not implemented yet, this might be the reason https://github.com/lukasbach/react-complex-tree/blob/665fce7c44886b59cf7fb3a4d17bd66790a72b26/packages/core/src/treeItem/useTreeItemRenderContext.ts#L94

To Reproduce

  1. try to rename from the context of renderItem renderer

Expected behavior The item should be renamed programmatically from the context

Desktop (please complete the following information):

lukasbach commented 2 years ago

Hi @Nishchit14, thank you for your report! This is fixed in version 1.1.9.

Nishchit14 commented 1 year ago

It's not working on 1.1.11. context.startRenamingItem(); is fires onRenamingItem callback but the UI has no change.

lukasbach commented 1 year ago

After investigating this again, I'm not even sure I properly fixed it the last time 🙃

This is now actually fixed as of 2.0.0. Storybook example: https://rct.lukasbach.com/storybook/?path=/story/core-basic-examples--tree-item-context-renaming