-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(web): Organization page - prefilter search results #15084
feat(web): Organization page - prefilter search results #15084
Conversation
WalkthroughThe changes introduce a new Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant MainLayout
participant Header
participant SearchInput
participant Menu
participant FilterTag
User->>MainLayout: Navigate to page
MainLayout->>MainLayout: extractOrganizationSlugFromPathname()
MainLayout->>Header: Pass organizationSearchFilter
Header->>SearchInput: Pass organizationSearchFilter
Header->>Menu: Pass organizationSearchFilter
SearchInput->>useSearch: Include organization parameter
SearchInput->>useSubmit: Include organization parameter
Menu->>FilterTag: Display filter tags based on organizationSearchFilter
User->>FilterTag: Click on filter tag
FilterTag->>SearchInput: Trigger search with organization parameter
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Datadog ReportAll test runs ✅ 10 Total Test Services: 0 Failed, 10 Passed Test ServicesThis report shows up to 10 services
🔻 Code Coverage Decreases vs Default Branch (1)
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15084 +/- ##
=======================================
Coverage ? 37.15%
=======================================
Files ? 6405
Lines ? 130235
Branches ? 37126
=======================================
Hits ? 48387
Misses ? 81848
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Outside diff range and nitpick comments (8)
apps/web/components/FilterTag/FilterTag.tsx (1)
9-9
: Add documentation for the newactive
prop inFilterTagProps
.It would be beneficial to include a brief comment describing the purpose and usage of the
active
property in theFilterTagProps
interface to improve code readability and maintainability.apps/web/components/Menu/Menu.tsx (1)
31-31
: Ensure the neworganizationSearchFilter
prop is documented in theProps
interface.Adding a comment to describe the
organizationSearchFilter
prop within theProps
interface would enhance the understandability and maintainability of the code.apps/web/components/Header/Header.tsx (1)
34-34
: Document theorganizationSearchFilter
prop inHeaderProps
.It's recommended to add a comment explaining the
organizationSearchFilter
prop in theHeaderProps
interface to clarify its purpose and usage.apps/web/components/SearchInput/SearchInput.tsx (2)
Line range hint
94-141
: RefactoruseSearch
anduseSubmit
hooks to improve clarity and maintainability.- const useSearch = (locale: Locale, term?: string, autocomplete?: boolean, organization?: string): SearchState => { + const useSearch = ({ locale, term, autocomplete, organization }: { locale: Locale; term?: string; autocomplete?: boolean; organization?: string }): SearchState => { - const useSubmit = (locale: Locale, onRouting?: () => void, organization?: string) => { + const useSubmit = ({ locale, onRouting, organization }: { locale: Locale; onRouting?: () => void; organization?: string }) => {Refactoring these hooks to use object destructuring for parameters can make the functions easier to read and maintain, especially as more parameters might be added in the future.
Also applies to: 177-197
233-233
: Ensure theorganization
prop inSearchInputProps
is documented.Adding a comment to describe the
organization
prop within theSearchInputProps
interface would help clarify its purpose and expected usage.apps/web/screens/Search/Search.tsx (3)
Line range hint
427-430
: Replace thedelete
operator with setting the property toundefined
.The use of the
delete
operator at lines 427-430 can lead to performance issues due to changes in object shape. It's better to set the property toundefined
.- delete newQuery['processentry'] + newQuery['processentry'] = undefinedTools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Line range hint
368-368
: Specify a more explicit type instead ofany
.The use of
any
at line 368 should be avoided as it disables TypeScript's static type checking. Consider specifying a more explicit type.- image: (item as any)?.singleOrganization?.logo, + image: (item as OrganizationPage)?.singleOrganization?.logo,Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Line range hint
1015-1015
: AddgetCount
to the dependency array ofuseMemo
.The
useMemo
hook at line 1015 uses the functiongetCount
but does not include it in its dependency array. This might lead to stale closures capturing outdated values ofgetCount
, which can cause bugs ifgetCount
changes over the component's lifecycle.- [q] + [q, getCount]Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (7)
- apps/web/components/FilterTag/FilterTag.tsx (1 hunks)
- apps/web/components/Header/Header.tsx (6 hunks)
- apps/web/components/Menu/Menu.tsx (3 hunks)
- apps/web/components/SearchInput/SearchInput.tsx (8 hunks)
- apps/web/layouts/main.tsx (3 hunks)
- apps/web/screens/Search/Search.tsx (4 hunks)
- apps/web/utils/organization.ts (2 hunks)
Additional context used
Path-based instructions (7)
apps/web/components/FilterTag/FilterTag.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/utils/organization.ts (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/components/Menu/Menu.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/components/Header/Header.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/components/SearchInput/SearchInput.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/layouts/main.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Search/Search.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
Biome
apps/web/components/SearchInput/SearchInput.tsx
[error] 67-67: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 67-67: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 87-87: This code is unreachable (lint/correctness/noUnreachable)
... because either this statement, ...
... this statement, ...
... this statement, ...
... this statement, ...
... this statement, ...
... or this statement will return from the function beforehand
[error] 118-163: The assignment should not be in an expression. (lint/suspicious/noAssignInExpressions)
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.
[error] 128-128: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 129-129: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 130-130: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 131-131: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 132-132: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 133-133: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 134-134: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 135-135: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 419-419: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 494-494: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 100-100: This hook does not specify all of its dependencies: autocomplete (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
[error] 100-100: This hook does not specify all of its dependencies: organization (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
[error] 100-100: This hook specifies more dependencies than necessary: dispatch (lint/correctness/useExhaustiveDependencies)
This dependency can be removed from the list.
[error] 265-265: This hook specifies more dependencies than necessary: setHasFocus (lint/correctness/useExhaustiveDependencies)
This dependency can be removed from the list.
[error] 266-266: This hook specifies more dependencies than necessary: setHasFocus (lint/correctness/useExhaustiveDependencies)
This dependency can be removed from the list.
[error] 512-512: Avoid passing content using the dangerouslySetInnerHTML prop. (lint/security/noDangerouslySetInnerHtml)
Setting content using code can expose users to cross-site scripting (XSS) attacks
apps/web/layouts/main.tsx
[error] 77-77: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 262-262: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)
This is the source of the key value.
The order of the items may change, and this also affects performances and component state.
Check the React documentation.apps/web/screens/Search/Search.tsx
[error] 368-368: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 427-430: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 427-430: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 657-657: Use === instead of ==.
== is only allowed when comparing againstnull
(lint/suspicious/noDoubleEquals)== is only allowed when comparing against null
Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===
[error] 773-782: Prefer for...of instead of forEach. (lint/complexity/noForEach)
forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
[error] 606-607: Missing key property for this element in iterable. (lint/correctness/useJsxKeyInIterable)
The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.
[error] 633-633: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)
This is the source of the key value.
The order of the items may change, and this also affects performances and component state.
Check the React documentation.
[error] 785-785: Avoid using the index of an array as key property in an element. (lint/suspicious/noArrayIndexKey)
This is the source of the key value.
The order of the items may change, and this also affects performances and component state.
Check the React documentation.
[error] 1015-1015: This hook does not specify all of its dependencies: getCount (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
Additional comments not posted (5)
apps/web/components/FilterTag/FilterTag.tsx (1)
15-15
: Ensure theactive
prop is handled correctly in all use cases.Verification successful
The
active
prop is correctly utilized in theFilterTag
component. It is passed from theSearch.tsx
file and used within theTag
component inFilterTag.tsx
.
- In
apps/web/screens/Search/Search.tsx
, theFilterTag
component is instantiated withactive={true}
.- In
apps/web/components/FilterTag/FilterTag.tsx
, theactive
prop is passed to theTag
component.This confirms that the
active
prop is handled correctly in theFilterTag
component.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `active` prop is correctly utilized wherever `FilterTag` is instantiated. # Test: Search for the component usage. Expect: Proper handling of the `active` prop. rg --type typescript $'(<FilterTag[^>]*>)'Length of output: 78
Script:
#!/bin/bash # Description: Verify that the `active` prop is correctly utilized wherever `FilterTag` is instantiated. # Test: Search for the component usage in .ts and .tsx files. Expect: Proper handling of the `active` prop. rg --type-add 'ts:*.{ts,tsx}' --type ts '<FilterTag[^>]*>'Length of output: 294
Script:
#!/bin/bash # Extract the relevant code from Search.tsx and FilterTag.tsx to verify the handling of the `active` prop. # Extract the usage of FilterTag in Search.tsx rg --type ts --context 5 '<FilterTag[^>]*>' apps/web/screens/Search/Search.tsx # Extract the implementation of FilterTag in FilterTag.tsx rg --type ts --context 10 'export const FilterTag' apps/web/components/FilterTag/FilterTag.tsxLength of output: 1121
apps/web/components/Header/Header.tsx (1)
99-99
: Check the propagation oforganizationSearchFilter
throughout theHeader
component.Also applies to: 122-122
Verification successful
The
organizationSearchFilter
is correctly passed within theHeader
component. It is defined as a prop, used in the component, and passed to other components.
organizationSearchFilter
is defined as a prop.- It is used within the
Header
component.- It is passed to the
organization
prop andorganizationSearchFilter
prop of other components.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `organizationSearchFilter` is correctly passed to both `SearchInput` and `Menu` components within `Header`. # Test: Search for the usage of `organizationSearchFilter` in `Header`. Expect: Correct prop passing. rg --type typescript $'Header[^{]*{[^}]*organizationSearchFilter[^}]*}'Length of output: 214
Script:
#!/bin/bash # Description: Verify that the `organizationSearchFilter` is correctly passed to both `SearchInput` and `Menu` components within `Header`. # Test: Search for the usage of `organizationSearchFilter` in `Header`. Expect: Correct prop passing. rg --type typescript 'organizationSearchFilter' apps/web/components/Header/Header.tsxLength of output: 120
Script:
#!/bin/bash # Description: Verify that the `organizationSearchFilter` is correctly passed to both `SearchInput` and `Menu` components within `Header`. # Test: Search for the usage of `organizationSearchFilter` in `Header`. Expect: Correct prop passing. rg 'organizationSearchFilter' apps/web/components/Header/Header.tsxLength of output: 273
apps/web/layouts/main.tsx (1)
250-253
: Validate the usage ofextractOrganizationSlugFromPathname
in theMainLayout
.Verification successful
The function
extractOrganizationSlugFromPathname
is correctly imported and used in theMainLayout
component.
apps/web/layouts/main.tsx
:
- Line:
import { extractOrganizationSlugFromPathname } from '../utils/organization'
- Line:
const organizationSearchFilter = extractOrganizationSlugFromPathname(
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Ensure that `extractOrganizationSlugFromPathname` is used correctly in the `MainLayout`. # Test: Search for the function usage in `MainLayout`. Expect: Correct implementation and usage. rg --type typescript $'extractOrganizationSlugFromPathname'Length of output: 93
Script:
#!/bin/bash # Description: Ensure that `extractOrganizationSlugFromPathname` is used correctly in the `MainLayout`. # Test: Search for the function usage in `MainLayout`. Expect: Correct implementation and usage. rg --type ts,tsx 'extractOrganizationSlugFromPathname'Length of output: 85
Script:
#!/bin/bash # Description: Ensure that `extractOrganizationSlugFromPathname` is used correctly in the `MainLayout`. # Test: Search for the function usage in `MainLayout`. Expect: Correct implementation and usage. rg --type-add 'ts:*.{ts,tsx}' --type ts 'extractOrganizationSlugFromPathname'Length of output: 361
apps/web/screens/Search/Search.tsx (2)
Line range hint
785-785
: Avoid using array indices as keys in React lists.This issue has been addressed in a previous comment regarding the use of array indices as keys.
Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
657-657
: Use strict equality for comparisons.The use of
==
for comparison at line 657 should be replaced with===
to avoid potential bugs related to type coercion.- countResults.processEntryCount == 'number' + countResults.processEntryCount === 'number'Likely invalid or redundant comment.
Tools
Biome
[error] 657-657: Use === instead of ==.
== is only allowed when comparing againstnull
(lint/suspicious/noDoubleEquals)== is only allowed when comparing against null
Using == may be unsafe if you are relying on type coercion
Unsafe fix: Use ===
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (4)
apps/web/screens/Search/Search.tsx (4)
Line range hint
427-430
: Avoid using the delete operator which can impact performance.- delete newQuery['processentry'] + newQuery['processentry'] = undefinedTools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Line range hint
427-430
: The computed expression can be simplified without the use of a string literal.- delete newQuery['processentry'] + delete newQuery.processentryTools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Line range hint
777-786
: Prefer for...of instead of forEach.- tags.forEach((tag) => { + for (const tag of tags) {Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Line range hint
1019-1019
: This hook does not specify all of its dependencies: getCount.- }, [q]) + }, [q, getCount])Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- apps/web/screens/Search/Search.tsx (4 hunks)
Additional context used
Path-based instructions (1)
apps/web/screens/Search/Search.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
Biome
apps/web/screens/Search/Search.tsx
[error] 427-430: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 427-430: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 777-786: Prefer for...of instead of forEach. (lint/complexity/noForEach)
forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
[error] 1019-1019: This hook does not specify all of its dependencies: getCount (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
Additional comments not posted (3)
apps/web/screens/Search/Search.tsx (3)
456-484
: Consider addingn
to the dependency array ofuseMemo
.Tools
Biome
[error] 456-456: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
606-610
: Add a uniquekey
prop to theFilterTag
component inside the map function.
637-658
: Avoid using array indices as keys in React lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (4)
apps/web/screens/Search/Search.tsx (4)
Line range hint
409-412
: Avoid using the delete operator as it can impact performance.Consider using an undefined assignment instead to avoid potential performance issues associated with the delete operator.
- delete newQuery['processentry'] + newQuery['processentry'] = undefined
Line range hint
409-412
: Simplify the computed expression without using a string literal.Using a literal key can simplify the code and enhance readability.
- newQuery['processentry'] + newQuery.processentry
Line range hint
759-768
: Preferfor...of
instead offorEach
for better performance.Using
for...of
can improve performance, especially when working with large arrays, by reducing the number of iterations.- filteredItems.forEach((item) => { + for (const item of filteredItems) {
Line range hint
1001-1001
: IncludegetCount
in the dependency array ofuseMemo
.To ensure that the memoized value updates correctly when
getCount
changes, it should be included in the dependency array.- }, [q]) + }, [q, getCount])
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- apps/web/screens/Search/Search.tsx (9 hunks)
Additional context used
Path-based instructions (1)
apps/web/screens/Search/Search.tsx (1)
Pattern
apps/**/*
: "Confirm that the code adheres to the following:
- NextJS best practices, including file structure, API routes, and static generation methods.
- Efficient state management and server-side rendering techniques.
- Optimal use of TypeScript for component and utility type safety."
Biome
apps/web/screens/Search/Search.tsx
[error] 409-412: Avoid the delete operator which can impact performance. (lint/performance/noDelete)
Unsafe fix: Use an undefined assignment instead.
[error] 409-412: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)
Unsafe fix: Use a literal key instead.
[error] 759-768: Prefer for...of instead of forEach. (lint/complexity/noForEach)
forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.
[error] 438-438: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
[error] 1001-1001: This hook does not specify all of its dependencies: getCount (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
Additional comments not posted (2)
apps/web/screens/Search/Search.tsx (2)
437-466
: Consider addingn
to the dependency array ofuseMemo
.This issue was previously flagged and remains valid. Including
n
in the dependency array ensures that the memoized value updates correctly when the namespace changes.Tools
Biome
[error] 438-438: This hook does not specify all of its dependencies: n (lint/correctness/useExhaustiveDependencies)
This dependency is not specified in the hook dependency list.
This dependency is not specified in the hook dependency list.
480-521
: Add a uniquekey
prop to theFilterTag
component inside the map function.This issue was previously flagged and remains valid. React requires a unique
key
prop for list items to maintain state consistency across re-renders.
* When on an organization page, prefilter results * Show what is filtered by via tags * Change keys * Remove comments * Make sure that selected is an array --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
* When on an organization page, prefilter results * Show what is filtered by via tags * Change keys * Remove comments * Make sure that selected is an array --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Organization page - prefilter search results
What
Example: Searching for "Embætti" on /s/syslumenn would previously show results related to "Embætti Landlæknis" but after the change we only see relevant search results that belong to "Sýslumenn"
Before
Screen.Recording.2024-06-04.at.12.50.32.mov
After
Screen.Recording.2024-06-04.at.12.50.58.mov
Checklist:
Summary by CodeRabbit
New Features
active
state control toFilterTag
component.organizationSearchFilter
for enhanced search functionality inHeader
,Menu
, andSearchInput
components.Search
screen with memoized categories and dynamic filter tags.Enhancements
Search
screen performance withuseMemo
for categories.SearchInput
.Refactor
Search.tsx
to useuseMemo
for better performance.