Skip to content

feat: apply selected files to filter#2058

Merged
mfortman11 merged 3 commits into
mainfrom
filter-creation-enhancement
Jul 13, 2026
Merged

feat: apply selected files to filter#2058
mfortman11 merged 3 commits into
mainfrom
filter-creation-enhancement

Conversation

@mfortman11

@mfortman11 mfortman11 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I always felt like if you select files in the knowledge table then click create filter those files should be auto added now they are

Screen.Recording.2026-07-08.at.4.16.32.PM.mov

Summary by CodeRabbit

  • New Features

    • Knowledge filters now stay in sync with your grid row selection, so selected sources always match what you’ve chosen.
    • When creating a new filter, the initial selected sources are prefilled from your current selection instead of always starting with the default “all sources” option.
  • Bug Fixes

    • Prevents stale or mismatched source selections by clearing and updating the selected sources as the grid selection changes.

@github-actions github-actions Bot added community frontend 🟨 Issues related to the UI/UX enhancement 🔵 New feature or request and removed community labels Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b0d07eef-5dec-4196-8ad4-d8fe1b1010c2

📥 Commits

Reviewing files that changed from the base of the PR and between 65ee644 and 068b6b6.

📒 Files selected for processing (1)
  • frontend/app/knowledge/page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/app/knowledge/page.tsx

Walkthrough

Adds selectedSources state and a setter to the knowledge filter context. The search page synchronizes selected grid row filenames into this state, and startCreateMode uses it to default data_sources filters.

Changes

Selected Sources State Sync

Layer / File(s) Summary
Filter context state and defaults
frontend/contexts/knowledge-filter-context.tsx
Adds selectedSources and setSelectedSources to the context type, provider state, and context value; startCreateMode uses selected sources or ["*"] for data_sources.
Search page grid selection sync
frontend/app/knowledge/page.tsx
Synchronizes selected row filenames into the filter context and clears the state during effect cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: wallgau

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: selected files are applied to the filter creation flow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch filter-creation-enhancement

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.

@github-actions github-actions Bot added enhancement 🔵 New feature or request and removed enhancement 🔵 New feature or request labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit d52246b.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/contexts/knowledge-filter-context.tsx (1)

199-200: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Consider memoizing the context value to reduce consumer re-renders.

selectedSources changes on every row selection/deselection, causing the provider to re-render and recreate the value object. Since the value is not memoized, all useKnowledgeFilter() consumers re-render on each selection change — even those that only read isPanelOpen or createMode. Memoizing would also require wrapping the provider's inline functions (setSelectedFilter, clearFilter, openPanel, etc.) in useCallback, so this is a broader refactor.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/contexts/knowledge-filter-context.tsx` around lines 199 - 200, The
KnowledgeFilterContext provider value is recreated on every `selectedSources`
update, causing unnecessary `useKnowledgeFilter()` consumer re-renders. Memoize
the context `value` in `KnowledgeFilterProvider` and wrap the inline handlers it
exposes (such as `setSelectedFilter`, `clearFilter`, `openPanel`, and related
setters) in `useCallback` so the object stays stable unless its real
dependencies change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@frontend/contexts/knowledge-filter-context.tsx`:
- Around line 199-200: The KnowledgeFilterContext provider value is recreated on
every `selectedSources` update, causing unnecessary `useKnowledgeFilter()`
consumer re-renders. Memoize the context `value` in `KnowledgeFilterProvider`
and wrap the inline handlers it exposes (such as `setSelectedFilter`,
`clearFilter`, `openPanel`, and related setters) in `useCallback` so the object
stays stable unless its real dependencies change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a2d95d3-d97f-49c4-ac82-a986c36e42ac

📥 Commits

Reviewing files that changed from the base of the PR and between 8e0f30b and 65ee644.

📒 Files selected for processing (2)
  • frontend/app/knowledge/page.tsx
  • frontend/contexts/knowledge-filter-context.tsx

@Wallgau Wallgau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approved but need to address React Doctor comment

@github-actions github-actions Bot added the lgtm label Jul 8, 2026
@github-actions github-actions Bot added enhancement 🔵 New feature or request and removed enhancement 🔵 New feature or request labels Jul 13, 2026
@github-actions github-actions Bot added enhancement 🔵 New feature or request and removed enhancement 🔵 New feature or request labels Jul 13, 2026
@mfortman11
mfortman11 merged commit 1c52697 into main Jul 13, 2026
32 of 38 checks passed
@github-actions
github-actions Bot deleted the filter-creation-enhancement branch July 13, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🔵 New feature or request frontend 🟨 Issues related to the UI/UX lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants