Skip to content

Conversation

@malinskibeniamin
Copy link
Contributor

Applies fixes from react-best-practices skill

New Utilities

1. src/utils/regex.ts - Cached search regex with proper escaping

  • escapeRegex() - escapes special regex characters
  • getSearchRegex() - returns cached, case-insensitive RegExp for search queries
  • LRU-style cache (max 100 entries) to avoid repeated regex compilation

2. src/utils/array-transforms.ts - Efficient array helpers

  • filterMap() - single-pass filter and map operation
  • partition() - split array into multiple buckets by classifier
  • partitionBy() - two-way partition based on predicate

3. src/hooks/use-safe-local-storage.ts - Safe localStorage access

  • useSafeLocalStorage() hook - handles incognito mode, quota errors, SSR
  • getLocalStorageFlag() / setLocalStorageFlag() - simple boolean flag helpers

Refactors

Search filtering standardization

Replaced duplicated try/catch regex patterns across 12 files with getSearchRegex():

  • acl-list.tsx (4 places)
  • role-details.tsx
  • admin-users.tsx
  • cluster-details.tsx
  • connect/overview.tsx
  • group-list.tsx
  • pipelines-list.tsx
  • secrets-list.tsx
  • schema-list.tsx
  • topic-list.tsx
  • transforms-list.tsx

Performance improvements

  • rp-connect/utils/yaml.ts - use Set instead of Array.includes() for label lookups
  • topic-filters-session.ts - module-level cache to avoid repeated sessionStorage parsing
  • topic-produce.tsx - watch individual form fields instead of objects to minimize effect reruns

Simplifications

  • ai-agent-configuration-tab.tsx - removed unnecessary useMemo wrappers for simple boolean/array derivations

Safe storage

  • banner.tsx - uses new safe localStorage helpers instead of direct localStorage access

@malinskibeniamin malinskibeniamin requested a review from a team January 22, 2026 14:08
@malinskibeniamin malinskibeniamin self-assigned this Jan 22, 2026
@malinskibeniamin malinskibeniamin requested review from jvorcak, r-vasquez and yougotashovel and removed request for a team January 22, 2026 14:08
Copy link
Collaborator

@jvorcak jvorcak left a comment

Choose a reason for hiding this comment

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

LGTM

@malinskibeniamin
Copy link
Contributor Author

Not merging for now - postponing for a future Console release. Going to keep it open

@blacksmith-sh

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants