Skip to content

Advanced filter: validate address input#3295

Merged
isstuev merged 1 commit intomainfrom
fe-2463
Feb 26, 2026
Merged

Advanced filter: validate address input#3295
isstuev merged 1 commit intomainfrom
fe-2463

Conversation

@isstuev
Copy link
Contributor

@isstuev isstuev commented Feb 25, 2026

Description and Related Issue(s)

resolves #2463

Checklist for PR author

  • I have tested these changes locally.
  • I added tests to cover any new functionality, following this guide
  • Whenever I fix a bug, I include a regression test to ensure that the bug does not reappear silently.
  • If I have added a feature or functionality that is not privacy-compliant (e.g., tracking, analytics, third-party services), I have disabled it for private mode.
  • If I have added, changed, renamed, or removed an environment variable
    • I updated the list of environment variables in the documentation
    • I made the necessary changes to the validator script according to the guide
    • I added "ENVs" label to this pull request

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include @coderabbitai review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
ui/advancedFilter/filters/AddressFilter.tsx (1)

41-56: Prefer interface over type for object shapes.

The InputProps and AddressFilter definitions use type but should use interface per coding guidelines.

♻️ Suggested refactor
-type InputProps = {
+interface InputProps {
   address?: string;
   mode?: AddressFilterMode;
   isLast: boolean;
   onModeChange: ({ value }: { value: Array<string> }) => void;
   onChange: (event: ChangeEvent<HTMLInputElement>) => void;
   onBlur: () => void;
   onClear: () => void;
   onAddFieldClick: () => void;
   isInvalid: boolean;
-};
+}

-type AddressFilter = {
+interface AddressFilter {
   address: string;
   mode: AddressFilterMode;
-};
+}

As per coding guidelines: "Prefer interfaces over types."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/advancedFilter/filters/AddressFilter.tsx` around lines 41 - 56, Replace
the object-shape type aliases with interfaces: change the declarations for
InputProps and AddressFilter to use the interface keyword (keep the same
property names/signatures: address, mode, isLast, onModeChange, onChange,
onBlur, onClear, onAddFieldClick, isInvalid for InputProps; address and mode for
AddressFilter) and update any references/imports if needed so the rest of the
file (components that accept InputProps and any code constructing AddressFilter)
continues to compile unchanged.
ui/advancedFilter/FilterByColumn.pw.tsx (1)

58-58: Avoid CSS class selectors in Playwright tests.

The selector .chakra-popover__content uses a CSS class, which violates coding guidelines. Use a role, test ID, or accessible attribute instead.

♻️ Suggested fix using role selector
-    const popover = page.locator('.chakra-popover__content');
+    const popover = page.getByRole('dialog');

As per coding guidelines: "In Playwright tests, use roles, test IDs, and text content as selectors — never CSS class selectors."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/advancedFilter/FilterByColumn.pw.tsx` at line 58, The test is using a CSS
class selector for the popover (const popover =
page.locator('.chakra-popover__content')), which violates the guideline; replace
that locator with an accessible selector such as page.getByRole(...) or a test
id for the popover (or use getByTestId/getByText as appropriate) so the popover
variable is located via role/test-id/text instead of a CSS class; update the
locator expression for the popover variable in FilterByColumn.pw.tsx to use the
chosen role or data-testid.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ui/advancedFilter/FilterByColumn.pw.tsx`:
- Line 58: The test is using a CSS class selector for the popover (const popover
= page.locator('.chakra-popover__content')), which violates the guideline;
replace that locator with an accessible selector such as page.getByRole(...) or
a test id for the popover (or use getByTestId/getByText as appropriate) so the
popover variable is located via role/test-id/text instead of a CSS class; update
the locator expression for the popover variable in FilterByColumn.pw.tsx to use
the chosen role or data-testid.

In `@ui/advancedFilter/filters/AddressFilter.tsx`:
- Around line 41-56: Replace the object-shape type aliases with interfaces:
change the declarations for InputProps and AddressFilter to use the interface
keyword (keep the same property names/signatures: address, mode, isLast,
onModeChange, onChange, onBlur, onClear, onAddFieldClick, isInvalid for
InputProps; address and mode for AddressFilter) and update any
references/imports if needed so the rest of the file (components that accept
InputProps and any code constructing AddressFilter) continues to compile
unchanged.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67ce6ae and f804da5.

⛔ Files ignored due to path filters (4)
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_dark-color-mode_from-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_dark-color-mode_to-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_default_from-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_default_to-filter-dark-mode-1.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • ui/advancedFilter/FilterByColumn.pw.tsx
  • ui/advancedFilter/filters/AddressFilter.tsx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
ui/advancedFilter/FilterByColumn.pw.tsx (1)

58-58: Avoid CSS class selectors in Playwright tests.

The selector .chakra-popover__content uses a CSS class, which violates the testing guidelines. Consider using a role-based selector or adding a data-testid to the popover content.

Suggested fix using role selector
- const popover = page.locator('.chakra-popover__content');
+ const popover = page.getByRole('dialog');

If the popover doesn't have dialog semantics, consider adding a test ID to the component:

- const popover = page.locator('.chakra-popover__content');
+ const popover = page.getByTestId('filter-popover-content');

As per coding guidelines: "In Playwright tests, use roles, test IDs, and text content as selectors — never CSS class selectors."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/advancedFilter/FilterByColumn.pw.tsx` at line 58, The test currently uses
a CSS class selector in the popover locator (the popover variable assigned with
page.locator('.chakra-popover__content')), which violates Playwright selector
guidelines; update the test to use a semantic selector (e.g., role-based locator
like page.getByRole('dialog') or page.locator('role=dialog') /
page.getByRole('dialog', { name: ... }) if the popover exposes dialog semantics)
or change the component to add a stable data-testid (e.g.,
data-testid="filter-popover") and then locate it with
page.getByTestId('filter-popover') instead of the '.chakra-popover__content'
selector so the popover variable no longer relies on class names.
ui/advancedFilter/filters/AddressFilter.tsx (1)

161-162: Consider renaming isTouched to hasChanges or isModified for clarity.

The variable on line 162 checks whether the current values differ from the original value prop, not whether fields have been "touched" (blurred). This naming could cause confusion with the touched state array which tracks actual user interaction. A name like hasChanges or isModified would better convey the intent.

Suggested rename for clarity
- const isTouched = !isEqual(currentValue.filter(i => i.address).map(addressFilterToKey).sort(), value.map(addressFilterToKey).sort());
+ const hasChanges = !isEqual(currentValue.filter(i => i.address).map(addressFilterToKey).sort(), value.map(addressFilterToKey).sort());

  return (
    <TableColumnFilter
      title={ type === 'from' ? 'From address' : 'To address' }
      isFilled={ Boolean(currentValue[0].address) }
-     isTouched={ isTouched && !hasErrors }
+     isTouched={ hasChanges && !hasErrors }
      onFilter={ onFilter }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/advancedFilter/filters/AddressFilter.tsx` around lines 161 - 162, Rename
the misleading variable isTouched in AddressFilter to a clearer name like
hasChanges (or isModified) because it compares currentValue vs value rather than
tracking user touch state; update the declaration that computes the boolean (the
line using currentValue.filter(i => i.address).map(addressFilterToKey).sort()
and value.map(addressFilterToKey).sort() with isEqual) and replace all usages of
isTouched throughout the AddressFilter component (including places that read it
to enable/disable buttons or pass into child components) to the new identifier,
preserving the exact boolean logic and imports for currentValue, value,
addressFilterToKey and isEqual.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ui/advancedFilter/FilterByColumn.pw.tsx`:
- Line 58: The test currently uses a CSS class selector in the popover locator
(the popover variable assigned with page.locator('.chakra-popover__content')),
which violates Playwright selector guidelines; update the test to use a semantic
selector (e.g., role-based locator like page.getByRole('dialog') or
page.locator('role=dialog') / page.getByRole('dialog', { name: ... }) if the
popover exposes dialog semantics) or change the component to add a stable
data-testid (e.g., data-testid="filter-popover") and then locate it with
page.getByTestId('filter-popover') instead of the '.chakra-popover__content'
selector so the popover variable no longer relies on class names.

In `@ui/advancedFilter/filters/AddressFilter.tsx`:
- Around line 161-162: Rename the misleading variable isTouched in AddressFilter
to a clearer name like hasChanges (or isModified) because it compares
currentValue vs value rather than tracking user touch state; update the
declaration that computes the boolean (the line using currentValue.filter(i =>
i.address).map(addressFilterToKey).sort() and
value.map(addressFilterToKey).sort() with isEqual) and replace all usages of
isTouched throughout the AddressFilter component (including places that read it
to enable/disable buttons or pass into child components) to the new identifier,
preserving the exact boolean logic and imports for currentValue, value,
addressFilterToKey and isEqual.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67ce6ae and f804da5.

⛔ Files ignored due to path filters (4)
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_dark-color-mode_from-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_dark-color-mode_to-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_default_from-filter-dark-mode-1.png is excluded by !**/*.png
  • ui/advancedFilter/__screenshots__/FilterByColumn.pw.tsx_default_to-filter-dark-mode-1.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • ui/advancedFilter/FilterByColumn.pw.tsx
  • ui/advancedFilter/filters/AddressFilter.tsx

@isstuev isstuev marked this pull request as ready for review February 26, 2026 16:15
@isstuev isstuev merged commit c6a444d into main Feb 26, 2026
12 checks passed
@isstuev isstuev deleted the fe-2463 branch February 26, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced filter: validate address input

1 participant