patternfly / patternfly/react-data-view

Initial Filters is not respected when array type filter

オープン 初心者向け
#671 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
4
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

When the user supplies an array type filter with initialFilters, the initialFilters are never used. The filter logic has the following code:

	  const urlValue = isArrayFilter ? searchParams?.getAll(key) : searchParams?.get(key);

      // eslint-disable-next-line no-nested-ternary
      loadedFilters[key] = urlValue
        ? (isArrayFilter && !Array.isArray(urlValue) ? [ urlValue ] : urlValue)
        : initialFilters[key];

The issue is that searchParams.getAll returns an empty array when key doesn't exist, so the truthy check on urlValue evaluates to true even though nothing is set.

This can be resolved by checking the length of the array when isArrayFilter is true


Jira Issue: PF-4302

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue に示されているフィルターロジックから始め、URL キーが存在しない場合に array フィルターと initialFilters がどのように読み込まれるかを追跡してください。array 型のフィルターでこのケースを再現し、URL の値が存在しない場合に設定された初期値が保持されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
frontend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。