Skip to content

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Oct 15, 2025

Description

This update fixes the duplicate issue in activity filters.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Streamlined activity filter options by removing the redundant “Default” option from available selections and initial defaults.
  • Bug Fixes

    • Prevented duplicate activity filters when toggling options, ensuring cleaner and more predictable filtering behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

The UI toggle logic for issue activity filters now deduplicates selections. In shared constants, the DEFAULT activity filter type and its inclusion in defaultActivityFilters were removed. No public API additions; EActivityFilterType lost the DEFAULT member.

Changes

Cohort / File(s) Summary of Changes
UI Activity Filter Handling
apps/web/core/components/issues/issue-detail/issue-activity/root.tsx
Import lodash-es/uniq; toggleFilter now applies uniq before setFilterValue, preventing duplicate filters.
Constants: Activity Filter Types
packages/constants/src/issue/filter.ts
Removed EActivityFilterType.DEFAULT enum member and its usage in defaultActivityFilters; updates public exports accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant C as IssueActivity UI
  participant S as State: filterValue
  participant F as Activity Feed

  U->>C: Click filter toggle
  C->>C: Build updated _filters
  C->>C: Deduplicate with uniq(_filters)
  C->>S: setFilterValue(deduped)
  S-->>F: Updated filters
  F-->>U: Render filtered activity
  note over C,S: Change: apply uniq before state update
Loading
sequenceDiagram
  participant UI as IssueActivity UI
  participant K as constants.defaultActivityFilters
  participant E as EActivityFilterType

  UI->>K: Load initial filters
  K-->>UI: Array without DEFAULT
  UI->>E: Reference available types
  E-->>UI: Enum (DEFAULT removed)
  note over K,E: DEFAULT option removed from defaults and enum
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I toggled a switch with a hop and a blink,
No duplicates now—uniq in a wink.
DEFAULT hopped off, bid a tidy adieu,
Filters align, crisp as morning dew.
Thump-thump, I code with carrot-bright cheer,
Clean lists, clear hops—onward from here! 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the primary change by indicating a bug fix in activity filters and references the related issue identifier without listing files or extraneous detail.
Description Check ✅ Passed The pull request description follows the repository’s template by providing a clear Description and Type of Change and including the required section headings even though optional details like screenshots and test scenarios are not filled out.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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 fix-activity_filters

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.

@pushya22 pushya22 changed the title fix: activity filters [WEB-5156] fix: activity filters bug Oct 15, 2025
@makeplane
Copy link

makeplane bot commented Oct 15, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

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

🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-detail/issue-activity/root.tsx (1)

69-80: Defensive deduplication is reasonable, but consider explicit migration.

The uniq call safely handles duplicates from stale localStorage (e.g., removed DEFAULT filter) or other sources. However, since the toggleFilter logic itself shouldn't create duplicates (it checks includes() before adding), consider adding an explicit one-time migration to clean up localStorage on component mount.

Optional: Add a migration effect to clean up legacy filter state:

useEffect(() => {
  if (selectedFilters) {
    const cleaned = uniq(selectedFilters.filter(f => 
      Object.values(EActivityFilterType).includes(f)
    ));
    if (cleaned.length !== selectedFilters.length || 
        cleaned.some((f, i) => f !== selectedFilters[i])) {
      setFilterValue(cleaned);
    }
  }
}, []); // Run once on mount

This would proactively remove invalid/duplicate filters rather than relying on user interaction to trigger cleanup.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8c253a and 86cad65.

📒 Files selected for processing (2)
  • apps/web/core/components/issues/issue-detail/issue-activity/root.tsx (2 hunks)
  • packages/constants/src/issue/filter.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/constants/src/issue/filter.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-09T20:42:31.843Z
Learnt from: lifeiscontent
PR: makeplane/plane#7922
File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19
Timestamp: 2025-10-09T20:42:31.843Z
Learning: In the makeplane/plane repository, React types are globally available through TypeScript configuration. Type annotations like React.FC, React.ReactNode, etc. can be used without explicitly importing the React namespace. The codebase uses the modern JSX transform, so React imports are not required for JSX or type references.

Applied to files:

  • apps/web/core/components/issues/issue-detail/issue-activity/root.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). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (2)
apps/web/core/components/issues/issue-detail/issue-activity/root.tsx (2)

5-5: LGTM: Tree-shakeable import follows best practices.

The per-function import from lodash-es/uniq is optimal for bundle size.

Based on learnings.


79-79: uniq() on setFilterValue for issue_activity_filters covers all writes; no other filter manipulations found.

@pushya22 pushya22 merged commit 9d757cc into preview Oct 15, 2025
7 checks passed
@pushya22 pushya22 deleted the fix-activity_filters branch October 15, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants