blueprint icon indicating copy to clipboard operation
blueprint copied to clipboard

ItemPredicate make onActiveItemChange fired twice and active item isn't the good one

Open LoiKos opened this issue 5 years ago • 4 comments

Environment

  • Package version(s): 3.28.1
  • Operating System: Mac OS - latest
  • Browser name and version: chrome Version 83.0.4103.106 (Build officiel) (64 bits)

Steps to reproduce

  1. Define a Select component with a custom item list render and item render
  2. Add itemPredicate function
  3. select an item
  4. Open the Select back ( active item isn't item selected )

Actual behavior

I don't know why but onActiveItemChange is fired twice when a itemPredicate is defined. First you get the selected item and just after onActiveItemChange is fired with the first item in the list with no reason.

Expected behavior

ActiveItem is the selected item when you open the list after a select.

LoiKos avatar Jun 25 '20 13:06 LoiKos

See in live in this code sandbox : https://codesandbox.io/s/strange-lamport-3zowo?file=/src/App.js

Notice that when you add the predicate the selected item isn't active when you re-open the select.

I also let some meaningful console.log that show you why this bug occurs.

LoiKos avatar Jun 25 '20 14:06 LoiKos

Can confirm the repro:

2020-06-29 11 57 24

adidahiya avatar Jun 29 '20 15:06 adidahiya

Any update on this issue? I can reproduce it as well.

bartzy avatar Oct 06 '20 12:10 bartzy

resetOnQuery={false}

this worked for me

taroplus avatar Aug 12 '22 18:08 taroplus