Skip to content

Conversation

@jaycnz
Copy link
Contributor

@jaycnz jaycnz commented Jan 14, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Tab navigation now syncs correctly with the URL and reliably switches between Active, Archived and Trashed views.
  • Improvements

    • Tag filtering trims extra whitespace, treats inputs of only spaces as showing all options, and performs case-insensitive matching for more accurate results.
  • Tests

    • Added comprehensive tests covering whitespace handling and filtering edge cases.

✏️ Tip: You can customize this high-level summary in your review settings.

@jaycnz jaycnz requested a review from edmonday January 14, 2026 02:39
@jaycnz jaycnz self-assigned this Jan 14, 2026
@jaycnz jaycnz added type: fix Iterations on existing features or infrastructure. Bug labels Jan 14, 2026
@linear
Copy link

linear bot commented Jan 14, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

Walkthrough

Renames the router query parameter from tab to status in StatusTabPanel (component and tests) and adds whitespace-trimming, case-insensitive filtering to TagsFilter with new tests for whitespace scenarios.

Changes

Cohort / File(s) Change Summary
StatusTabPanel Refactor
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx, apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
Updated navigation and tab-state logic to use status query parameter instead of tab; updated tests and mocked router/query values accordingly.
TagsFilter Enhancement
libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx
Added custom filterOptions for Autocomplete: trims and lowercases input, returns all options for empty input, otherwise filters by option.name.primary inclusion.
TagsFilter Tests
libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
Added tests for trimming/whitespace handling and case-insensitive filtering; imported screen and userEvent for interactions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • edmonday
  • mikeallisonJS
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: overriding the autocomplete filter to trim whitespace in the TagsFilter component, which is the primary functional change across the files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jaychen/nes-474-templates-clicking-space-bar-in-the-search-bar-bugs-the


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0d2fd41 and f799f26.

📒 Files selected for processing (3)
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

**/*.{ts,tsx,js,jsx}: Use early returns whenever possible to make the code more readable.
Use descriptive variable and function/const names.
Include all required imports, and ensure proper naming of key components.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

Define a type if possible.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
apps/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/apps.mdc)

apps/**/*.{js,jsx,ts,tsx}: Always use MUI over HTML elements; avoid using CSS or tags.
Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
🧠 Learnings (5)
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/watch/test`.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Enclose SWR-based hooks in `TestSWRConfig` (`apps/watch/test/TestSWRConfig.tsx`) to isolate cache state between assertions in tests.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/resources/test`

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Use the shared Jest setup in `apps/watch/setupTests.tsx` which already boots MSW, Next router mock, and has a longer async timeout.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Enclose SWR-based hooks in `TestSWRConfig` (`apps/resources/test/TestSWRConfig.tsx`) to isolate cache state between assertions

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Deploy Preview (videos-admin, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (resources, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (watch, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys-admin, 8592/merge, pull_request, 22)
  • GitHub Check: lint (22)
  • GitHub Check: build (22)
🔇 Additional comments (2)
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx (1)

89-95: LGTM on the status parameter usage in push and unmountUntilVisible logic.

The updated query parameter and mounting conditions are consistent with the rename to status. Once line 64 is also updated to read from status, the implementation will be fully consistent.

Also applies to: 146-172

apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx (1)

196-230: LGTM!

This test correctly uses status in both the mock (line 201) and expectation (line 225). The other tests should follow this pattern.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@nx-cloud
Copy link

nx-cloud bot commented Jan 14, 2026

View your CI Pipeline Execution ↗ for commit f799f26

Command Status Duration Result
nx run watch-e2e:e2e ✅ Succeeded 24s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 3m 55s View ↗
nx run journeys-e2e:e2e ✅ Succeeded 18s View ↗
nx run resources-e2e:e2e ✅ Succeeded 9s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 11s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 25s View ↗
Additional runs (12) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-01-14 02:54:19 UTC

@github-actions github-actions bot requested a deployment to Preview - journeys-admin January 14, 2026 02:40 Pending
@github-actions github-actions bot requested a deployment to Preview - resources January 14, 2026 02:40 Pending
@github-actions github-actions bot requested a deployment to Preview - videos-admin January 14, 2026 02:40 Pending
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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx (1)

63-65: Inconsistent query parameter: reading tab but writing status.

Line 64 still reads from router?.query?.tab to determine the initial tab index, but Line 91 now writes status to the URL. This breaks URL-driven tab state—users who refresh the page or share a link with ?status=archived will always land on the Active tab because the component looks for tab instead.

🐛 Proposed fix
   const tabIndex =
-    journeyStatusTabs.find((status) => status.queryParam === router?.query?.tab)
+    journeyStatusTabs.find((status) => status.queryParam === router?.query?.status)
       ?.tabIndex ?? 0
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx (1)

16-19: Test mocks still use tab instead of status.

The default mock and several test setups (lines 97, 127, 161) still use tab in router.query, while line 197 correctly uses status. Once the component bug is fixed (reading from status instead of tab), these mocks should also be updated for consistency. Currently, tests pass because the component has the same inconsistency.

🔧 Suggested mock updates (apply after fixing the component)
 jest.mock('next/router', () => ({
   __esModule: true,
-  useRouter: jest.fn(() => ({ query: { tab: undefined } }))
+  useRouter: jest.fn(() => ({ query: { status: undefined } }))
 }))

And similarly update lines 97, 127, and 161 to use status instead of tab.

🧹 Nitpick comments (1)
libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx (1)

2-2: Unused import: screen.

The screen import from @testing-library/react is added but never used in the tests. All tests use destructured queries from render() instead.

🔧 Remove unused import
-import { fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { fireEvent, render, waitFor } from '@testing-library/react'
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f1d0722 and 0d2fd41.

📒 Files selected for processing (4)
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

**/*.{ts,tsx,js,jsx}: Use early returns whenever possible to make the code more readable.
Use descriptive variable and function/const names.
Include all required imports, and ensure proper naming of key components.

Files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

Define a type if possible.

Files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
apps/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/apps.mdc)

apps/**/*.{js,jsx,ts,tsx}: Always use MUI over HTML elements; avoid using CSS or tags.
Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
🧠 Learnings (11)
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/watch/test`.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Enclose SWR-based hooks in `TestSWRConfig` (`apps/watch/test/TestSWRConfig.tsx`) to isolate cache state between assertions in tests.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Enclose SWR-based hooks in `TestSWRConfig` (`apps/resources/test/TestSWRConfig.tsx`) to isolate cache state between assertions

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-07-22T18:37:24.555Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: .cursor/rules/base.mdc:0-0
Timestamp: 2025-07-22T18:37:24.555Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports, and ensure proper naming of key components.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/resources/test`

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Wrap component specs with `MockedProvider`, `VideoProvider`, and `WatchProvider` when the unit touches those contexts—`NewVideoContentPage.spec.tsx` shows the expected harness

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
📚 Learning: 2025-07-27T21:59:10.507Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: .cursor/rules/watch-modern.mdc:0-0
Timestamp: 2025-07-27T21:59:10.507Z
Learning: Applies to apps/watch-modern/**/*.test.{tsx,jsx} : Use 'testing-library/react' npm package for frontend tests.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
📚 Learning: 2025-11-16T21:30:53.412Z
Learnt from: Kneesal
Repo: JesusFilm/core PR: 8309
File: apps/journeys-admin/setupTests.tsx:47-51
Timestamp: 2025-11-16T21:30:53.412Z
Learning: In apps/journeys-admin/setupTests.tsx, the `document.clearImmediate` mock is required for tests involving the mux upload provider, as an underlying library uses clearImmediate for timeout management to prevent race conditions and unnecessary polling calls.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
📚 Learning: 2025-07-27T21:59:04.362Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: .cursor/rules/apps.mdc:0-0
Timestamp: 2025-07-27T21:59:04.362Z
Learning: Applies to apps/**/*.test.{js,jsx,ts,tsx} : Use 'testing-library/react' npm package for frontend tests.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Use the shared Jest setup in `apps/watch/setupTests.tsx` which already boots MSW, Next router mock, and has a longer async timeout.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-07-15T03:19:49.322Z
Learnt from: Kneesal
Repo: JesusFilm/core PR: 7171
File: apps/watch/src/components/LanguageSwitchDialog/SubtitlesSelect/SubtitlesSelect.spec.tsx:447-451
Timestamp: 2025-07-15T03:19:49.322Z
Learning: In the SubtitlesSelect component tests, the team intentionally uses integration tests that verify interactions work without errors rather than explicitly testing function calls, with explanatory comments to inform future developers of this testing strategy.

Applied to files:

  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
🧬 Code graph analysis (1)
libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx (2)
libs/journeys/ui/src/components/TemplateGallery/data.ts (1)
  • getTagsMock (362-580)
libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx (1)
  • TagsFilter (29-249)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Deploy Preview (resources, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys-admin, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (videos-admin, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (watch, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys, 8592/merge, pull_request, 22)
  • GitHub Check: build (22)
  • GitHub Check: lint (22)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx (1)

146-171: LGTM on unmount logic.

The unmountUntilVisible conditions correctly handle the default case (active tab when status is undefined) and the explicit status cases for archived and trashed panels.

apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx (1)

150-154: Push assertions correctly verify the status parameter.

The test expectations for router.push calls are correctly updated to verify the new status query parameter.

Also applies to: 184-190, 220-226

libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.tsx (2)

91-101: LGTM! The filter function correctly handles whitespace and case-insensitivity.

The implementation properly addresses the spacebar bug by:

  • Trimming leading/trailing whitespace before filtering
  • Returning all options when input is only whitespace
  • Performing case-insensitive substring matching

115-115: Good integration with Autocomplete.

The filterOptions prop is correctly wired to override MUI's default filtering behavior.

libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx (4)

429-449: Good test coverage for leading/trailing space trimming.

The test correctly verifies that input like ' Add ' filters to options containing "Add" after trimming.


451-467: Good test for whitespace-only input.

Correctly verifies that typing only spaces returns all available options.


469-490: Good test for internal spaces preservation.

Correctly verifies that spaces within the search term are not trimmed, ensuring exact substring matching after edge trimming.


492-528: Comprehensive case-insensitivity test.

Good coverage of various case combinations (uppercase, mixed, lowercase) to verify the toLowerCase() normalization works correctly.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions github-actions bot temporarily deployed to Preview - journeys January 14, 2026 02:43 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources January 14, 2026 02:43 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin January 14, 2026 02:43 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin January 14, 2026 02:43 Inactive
@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Wed Jan 14 15:45:24 NZDT 2026

@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Wed Jan 14 15:46:04 NZDT 2026

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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx (1)

63-65: Incomplete parameter rename: still reading from tab instead of status.

Line 64 reads from router?.query?.tab, but the component now pushes to status (line 91) and checks status in unmountUntilVisible (lines 151, 161, 169). This inconsistency means URL-driven initial tab selection will fail when users navigate directly to a URL with ?status=archived.

🐛 Proposed fix
   const tabIndex =
-    journeyStatusTabs.find((status) => status.queryParam === router?.query?.tab)
+    journeyStatusTabs.find((status) => status.queryParam === router?.query?.status)
       ?.tabIndex ?? 0
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx (4)

16-19: Update default mock to use status instead of tab.

The default mock at line 18 still uses tab, but the implementation (once fixed) will read from status. Update for consistency.

🐛 Proposed fix
 jest.mock('next/router', () => ({
   __esModule: true,
-  useRouter: jest.fn(() => ({ query: { tab: undefined } }))
+  useRouter: jest.fn(() => ({ query: { status: undefined } }))
 }))

94-120: Update mock to use status instead of tab.

This test verifies URL-driven initial tab selection. The mock at lines 96-98 uses tab: 'archived', but should use status: 'archived' to match the renamed parameter.

🐛 Proposed fix
     mockedUseRouter.mockReturnValue({
       query: {
-        tab: 'archived'
+        status: 'archived'
       }
     } as unknown as NextRouter)

122-158: Update mock to use status instead of tab.

Lines 126-127 mock tab: 'archived', but should use status: 'archived'. The push expectation at lines 150-156 correctly expects status.

🐛 Proposed fix
     mockedUseRouter.mockReturnValue({
       query: {
-        tab: 'archived'
+        status: 'archived'
       },
       push
     } as unknown as NextRouter)

160-194: Update mock to use status instead of tab.

Lines 164-165 mock tab: 'active', but should use status: 'active'. The push expectation at lines 188-192 correctly expects status.

🐛 Proposed fix
     mockedUseRouter.mockReturnValue({
       query: {
-        tab: 'active'
+        status: 'active'
       },
       push
     } as unknown as NextRouter)
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0d2fd41 and f799f26.

📒 Files selected for processing (3)
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/journeys/ui/src/components/TemplateGallery/TagsFilter/TagsFilter.spec.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

**/*.{ts,tsx,js,jsx}: Use early returns whenever possible to make the code more readable.
Use descriptive variable and function/const names.
Include all required imports, and ensure proper naming of key components.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/base.mdc)

Define a type if possible.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
apps/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/apps.mdc)

apps/**/*.{js,jsx,ts,tsx}: Always use MUI over HTML elements; avoid using CSS or tags.
Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx
  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
🧠 Learnings (5)
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/watch/test`.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Enclose SWR-based hooks in `TestSWRConfig` (`apps/watch/test/TestSWRConfig.tsx`) to isolate cache state between assertions in tests.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Co-locate React Testing Library specs under `*.spec.ts(x)` and mock network traffic with MSW handlers in `apps/resources/test`

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T04:58:24.460Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/watch/AGENTS.md:0-0
Timestamp: 2025-12-19T04:58:24.460Z
Learning: Applies to apps/watch/src/**/*.spec.{ts,tsx} : Use the shared Jest setup in `apps/watch/setupTests.tsx` which already boots MSW, Next router mock, and has a longer async timeout.

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
📚 Learning: 2025-12-19T19:18:43.790Z
Learnt from: CR
Repo: JesusFilm/core PR: 0
File: apps/resources/AGENTS.md:0-0
Timestamp: 2025-12-19T19:18:43.790Z
Learning: Applies to apps/resources/**/*.spec.ts?(x) : Enclose SWR-based hooks in `TestSWRConfig` (`apps/resources/test/TestSWRConfig.tsx`) to isolate cache state between assertions

Applied to files:

  • apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Deploy Preview (videos-admin, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (resources, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (watch, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys, 8592/merge, pull_request, 22)
  • GitHub Check: Deploy Preview (journeys-admin, 8592/merge, pull_request, 22)
  • GitHub Check: lint (22)
  • GitHub Check: build (22)
🔇 Additional comments (2)
apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.tsx (1)

89-95: LGTM on the status parameter usage in push and unmountUntilVisible logic.

The updated query parameter and mounting conditions are consistent with the rename to status. Once line 64 is also updated to read from status, the implementation will be fully consistent.

Also applies to: 146-172

apps/journeys-admin/src/components/StatusTabPanel/StatusTabPanel.spec.tsx (1)

196-230: LGTM!

This test correctly uses status in both the mock (line 201) and expectation (line 225). The other tests should follow this pattern.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Wed Jan 14 15:46:41 NZDT 2026

@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Wed Jan 14 15:46:42 NZDT 2026

@github-actions
Copy link
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Wed Jan 14 15:47:29 NZDT 2026

Comment on lines +91 to +101
const filterOptions = (options: Tag[], state: { inputValue: string }) => {
const trimmedInput = state.inputValue.trim().toLowerCase()
if (trimmedInput === '') {
return options
}

return options.filter((option) => {
const label = option.name.find(({ primary }) => primary)?.value ?? ''
return label.toLowerCase().includes(trimmedInput)
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like MUI has a convenient way of doing this, can you investigate?

https://mui.com/material-ui/react-autocomplete/#custom-filter

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

Labels

Bug type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants