frontend: add console best practices #2172
Open
+710
−155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Applies fixes from react-best-practices skill
New Utilities
1.
src/utils/regex.ts- Cached search regex with proper escapingescapeRegex()- escapes special regex charactersgetSearchRegex()- returns cached, case-insensitive RegExp for search queries2.
src/utils/array-transforms.ts- Efficient array helpersfilterMap()- single-pass filter and map operationpartition()- split array into multiple buckets by classifierpartitionBy()- two-way partition based on predicate3.
src/hooks/use-safe-local-storage.ts- Safe localStorage accessuseSafeLocalStorage()hook - handles incognito mode, quota errors, SSRgetLocalStorageFlag()/setLocalStorageFlag()- simple boolean flag helpersRefactors
Search filtering standardization
Replaced duplicated try/catch regex patterns across 12 files with
getSearchRegex():acl-list.tsx(4 places)role-details.tsxadmin-users.tsxcluster-details.tsxconnect/overview.tsxgroup-list.tsxpipelines-list.tsxsecrets-list.tsxschema-list.tsxtopic-list.tsxtransforms-list.tsxPerformance improvements
rp-connect/utils/yaml.ts- useSetinstead ofArray.includes()for label lookupstopic-filters-session.ts- module-level cache to avoid repeated sessionStorage parsingtopic-produce.tsx- watch individual form fields instead of objects to minimize effect rerunsSimplifications
ai-agent-configuration-tab.tsx- removed unnecessaryuseMemowrappers for simple boolean/array derivationsSafe storage
banner.tsx- uses new safe localStorage helpers instead of directlocalStorageaccess