Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(FR-460): handle undefined value as controlled value in BAIPropertyFilter #2999

Merged

Conversation

yomybaby
Copy link
Member

@yomybaby yomybaby commented Jan 6, 2025

Resolves #3095 (FR-460)

Why refactoring?

In the BAIPropertyFilter component, when the value is explicitly set to undefined, it should be treated as having no value rather than being in an uncontrolled mode. Currently, this causes issues where the component's internal state does not update when the value is changed via props from the parent, rather than being reset by the user. This issue needs to be addressed to ensure proper state management.

Changes

Replaces useDynamicList with useControllableValue in the BAIPropertyFilter component to improve filter state management. This change:

  • Introduces key-based filter tracking for more reliable tag removal
  • Simplifies filter value updates through a centralized update function
  • Fixes empty string handling in filter parsing
  • Removes unnecessary effect hook dependencies
  • Streamlines option generation for the AutoComplete component

Copy link
Member Author

yomybaby commented Jan 6, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Jan 6, 2025

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
4.9% (-0% 🔻)
398/8119
🔴 Branches 4.24% 239/5636
🔴 Functions
2.95% (-0% 🔻)
78/2644
🔴 Lines
4.82% (-0% 🔻)
383/7942
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / BAIPropertyFilter.tsx
10.26% (-0.85% 🔻)
0%
3.45% (-0.4% 🔻)
11.27% (-0.67% 🔻)

Test suite run success

124 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from 5c179f8

@yomybaby yomybaby changed the title refactor: handle undefined value as controlled value in BAIPropertyFilter refactor(FR-324): handle undefined value as controlled value in BAIPropertyFilter Jan 23, 2025
@yomybaby yomybaby changed the title refactor(FR-324): handle undefined value as controlled value in BAIPropertyFilter refactor(FR-319): handle undefined value as controlled value in BAIPropertyFilter Jan 23, 2025
@yomybaby yomybaby force-pushed the refactor/undefined-controlled-value-in-baipropertyfilter branch 3 times, most recently from e8aa9e4 to eb05507 Compare February 4, 2025 03:00
@yomybaby yomybaby marked this pull request as ready for review February 4, 2025 09:49
@yomybaby yomybaby changed the title refactor(FR-319): handle undefined value as controlled value in BAIPropertyFilter refactor(FR-460): handle undefined value as controlled value in BAIPropertyFilter Feb 4, 2025
Copy link
Contributor

@ironAiken2 ironAiken2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

graphite-app bot commented Feb 5, 2025

Merge activity

…opertyFilter (#2999)

Resolves #3095 (FR-460)

## Why refactoring?
In the `BAIPropertyFilter` component, when the `value` is explicitly set to `undefined`, it should be treated as having no value rather than being in an uncontrolled mode. Currently, this causes issues where the component's internal state does not update when the `value` is changed via props from the parent, rather than being reset by the user. This issue needs to be addressed to ensure proper state management.

## Changes
Replaces `useDynamicList` with `useControllableValue` in the BAIPropertyFilter component to improve filter state management. This change:

- Introduces key-based filter tracking for more reliable tag removal
- Simplifies filter value updates through a centralized update function
- Fixes empty string handling in filter parsing
- Removes unnecessary effect hook dependencies
- Streamlines option generation for the AutoComplete component
@graphite-app graphite-app bot force-pushed the refactor/undefined-controlled-value-in-baipropertyfilter branch from eb05507 to 5c179f8 Compare February 5, 2025 11:04
@graphite-app graphite-app bot merged commit 5c179f8 into main Feb 5, 2025
8 checks passed
@graphite-app graphite-app bot deleted the refactor/undefined-controlled-value-in-baipropertyfilter branch February 5, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M 30~100 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle Undefined Value as Controlled Value in BAIPropertyFilter
2 participants