palantir/blueprint

[select] On rerender / item list change, Suggest does not set active item to selected item

オープン

#4,562 opened on 2021/03/04

 (2 件のコメント) (2 件のリアクション) (0 人の担当者)TypeScript (2,167 件のフォーク)batch import
P3Package: selectType: bughelp wanted

Repository metrics

Stars
 (20,263 個のスター)
PR merge metrics
 (平均マージ 43d 10h) (30d で 27 merged PRs)

説明

Environment

  • Package version(s):
    • @blueprintjs/core: 3.39.0
    • @blueprintjs/select: 3.15.5
  • Operating System: all
  • Browser name and version: all

Code Sandbox

Link to a minimal repro: https://codesandbox.io/s/blueprint-sandbox-forked-rf75x?file=/src/index.tsx

Steps to reproduce

  1. Click Suggest input, note that 3 is active.
  2. Click "Reload item list," which simulates reloading list from network, etc.
  3. Click Suggest input, note that 1 is active instead 3, which is selected
  4. Blur focus on Suggest
  5. Click Suggest input again, note that active item finally resets to 3

Actual behavior

In step 3 above, the selected item is not active.

Expected behavior

In step 3, the selected item is active (assuming it's in the new list).

Possible solution

Might be that than maybeResetActiveItemToSelectedItem should be called in wider conditions than https://github.com/palantir/blueprint/blob/develop/packages/select/src/components/select/suggest.tsx#L157? But not too familiar with the implementation of Suggest.

コントリビューターガイド