Skip to content

[WEB-4979] fix: filters row missing for preset workspace views#7836

Merged
pushya22 merged 1 commit intopreviewfrom
fix-preset-workspace-view-filters
Sep 22, 2025
Merged

[WEB-4979] fix: filters row missing for preset workspace views#7836
pushya22 merged 1 commit intopreviewfrom
fix-preset-workspace-view-filters

Conversation

@prateekshourya29
Copy link
Member

@prateekshourya29 prateekshourya29 commented Sep 22, 2025

Description

This PR fixes an issue where predefined workspace views (like All, Assigned, Subscribed work items etc) were not displaying the filters bar. The problem occurred because for preset views, viewDetails are not available from the API, causing the filters to not be properly initialized in the initialWorkItemFilters logic.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • Bug Fixes
    • Filters now reflect the selected view accurately and no longer appear when a view is missing or unsupported.
    • Prevents empty or stale filters when switching views or when view details are unavailable.
  • Refactor
    • Optimized filter initialization to reduce unnecessary recalculations, improving responsiveness when navigating between views.

@makeplane
Copy link

makeplane bot commented Sep 22, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

Introduces a memoized computation for initialWorkItemFilters in all-issue-layout-root.tsx, adding conditional handling for missing globalViewId and distinguishing static vs non-static views using STATIC_VIEW_TYPES and viewDetails. Preserves output structure, sourcing richFilters from viewDetails.rich_filters or defaulting to an empty object.

Changes

Cohort / File(s) Summary
Issue layout filters memoization
apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx
Added useMemo and STATIC_VIEW_TYPES. Replaced direct initialization of initialWorkItemFilters with memoized logic conditioned on globalViewId, STATIC_VIEW_TYPES, and viewDetails. Returns undefined for invalid contexts; otherwise returns displayFilters, displayProperties, kanbanFilters, and richFilters (from viewDetails or default {}).

Sequence Diagram(s)

sequenceDiagram
  participant UI as AllIssueLayoutRoot
  participant State as State/Props
  participant View as ViewDetails
  participant Const as STATIC_VIEW_TYPES

  UI->>State: Read globalViewId, workItemFilters
  UI->>View: Access viewDetails
  UI->>Const: Check if view is static
  alt No globalViewId
    UI-->>UI: initialWorkItemFilters = undefined
  else Non-static AND no viewDetails
    UI-->>UI: initialWorkItemFilters = undefined
  else Valid context
    UI-->>UI: Build {displayFilters, displayProperties, kanbanFilters, richFilters}
  end
  note over UI: Memoized with deps: [globalViewId, viewDetails, workItemFilters]
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend, ready to merge

Suggested reviewers

  • vamsikrishnamathala

Poem

A rabbit taps keys with gentle cheer,
Memoized thoughts now crisp and clear.
If views go missing, we won’t pretend—
Undefined we return, not twist nor bend.
Filters hop in tidy rows,
Rich or empty, as logic goes. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[WEB-4979] fix: filters row missing for preset workspace views" is concise, directly describes the primary change (restoring the filters row for preset workspace views), and includes the tracking ID; it is clear and relevant to the changeset summary.
Description Check ✅ Passed The PR description clearly explains the bug, its root cause (preset views lacking viewDetails), and marks the change as a non-breaking bug fix, satisfying the template's core requirements for reviewers to understand what changed and why. It does omit optional template sections such as "Screenshots and Media", "Test Scenarios", and "References", which would help verification and traceability. Because the essential information is present and reviewers can understand the fix, this is acceptable as a pass while recommending those additions.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-preset-workspace-view-filters

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@prateekshourya29 prateekshourya29 added requires approval 🐛bug Something isn't working labels Sep 22, 2025
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: 1

🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx (1)

1-1: Avoid useMemo with MobX observables; drop unused import after refactor.

useMemo around MobX values can freeze updates; computing inline is cheap and safer.

Apply:

-import React, { useCallback, useMemo } from "react";
+import React, { useCallback } from "react";
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14e3aac and 3ab86f8.

📒 Files selected for processing (1)
  • apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx (1)
packages/types/src/workspace-views.ts (1)
  • STATIC_VIEW_TYPES (35-35)
⏰ 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). (1)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (1)
apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx (1)

7-7: Confirmed: STATIC_VIEW_TYPES usage is correct and router param is the slug

STATIC_VIEW_TYPES = ["all-issues","assigned","created","subscribed"]. Evidence: packages/types/src/workspace-views.ts:35; apps/web/core/store/issue/workspace/filter.store.ts checks STATIC_VIEW_TYPES.includes(viewId) and treats non-static IDs as saved views (lines ~138–174, 260–282); routes/hrefs use slug paths (packages/constants/src/workspace.ts:254). No changes required.

Comment on lines +48 to 64
// Determine initial work item filters based on view type and availability
const initialWorkItemFilters = useMemo(() => {
if (!globalViewId) return undefined;

const isStaticView = STATIC_VIEW_TYPES.includes(globalViewId);
const hasViewDetails = Boolean(viewDetails);

if (!isStaticView && !hasViewDetails) return undefined;

return {
displayFilters: workItemFilters?.displayFilters,
displayProperties: workItemFilters?.displayProperties,
kanbanFilters: workItemFilters?.kanbanFilters,
richFilters: viewDetails?.rich_filters ?? {},
};
}, [globalViewId, viewDetails, workItemFilters]);

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

MobX reactivity hazard + richFilters precedence.

  • useMemo may not recompute when nested observable fields change, causing stale filters.
  • Prefer store richFilters before viewDetails.rich_filters to preserve user state.

Apply:

-  // Determine initial work item filters based on view type and availability
-  const initialWorkItemFilters = useMemo(() => {
-    if (!globalViewId) return undefined;
-
-    const isStaticView = STATIC_VIEW_TYPES.includes(globalViewId);
-    const hasViewDetails = Boolean(viewDetails);
-
-    if (!isStaticView && !hasViewDetails) return undefined;
-
-    return {
-      displayFilters: workItemFilters?.displayFilters,
-      displayProperties: workItemFilters?.displayProperties,
-      kanbanFilters: workItemFilters?.kanbanFilters,
-      richFilters: viewDetails?.rich_filters ?? {},
-    };
-  }, [globalViewId, viewDetails, workItemFilters]);
+  // Determine initial work item filters based on view type and availability
+  const isStaticView = globalViewId ? STATIC_VIEW_TYPES.includes(globalViewId) : false;
+  const hasViewDetails = Boolean(viewDetails);
+  const initialWorkItemFilters =
+    !globalViewId
+      ? undefined
+      : !isStaticView && !hasViewDetails
+      ? undefined
+      : {
+          displayFilters: workItemFilters?.displayFilters,
+          displayProperties: workItemFilters?.displayProperties,
+          kanbanFilters: workItemFilters?.kanbanFilters,
+          // Prefer in-store richFilters; fall back to view details; then empty object.
+          richFilters: workItemFilters?.richFilters ?? viewDetails?.rich_filters ?? {},
+        };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Determine initial work item filters based on view type and availability
const initialWorkItemFilters = useMemo(() => {
if (!globalViewId) return undefined;
const isStaticView = STATIC_VIEW_TYPES.includes(globalViewId);
const hasViewDetails = Boolean(viewDetails);
if (!isStaticView && !hasViewDetails) return undefined;
return {
displayFilters: workItemFilters?.displayFilters,
displayProperties: workItemFilters?.displayProperties,
kanbanFilters: workItemFilters?.kanbanFilters,
richFilters: viewDetails?.rich_filters ?? {},
};
}, [globalViewId, viewDetails, workItemFilters]);
// Determine initial work item filters based on view type and availability
const isStaticView = globalViewId ? STATIC_VIEW_TYPES.includes(globalViewId) : false;
const hasViewDetails = Boolean(viewDetails);
const initialWorkItemFilters =
!globalViewId
? undefined
: !isStaticView && !hasViewDetails
? undefined
: {
displayFilters: workItemFilters?.displayFilters,
displayProperties: workItemFilters?.displayProperties,
kanbanFilters: workItemFilters?.kanbanFilters,
// Prefer in-store richFilters; fall back to view details; then empty object.
richFilters: workItemFilters?.richFilters ?? viewDetails?.rich_filters ?? {},
};
🤖 Prompt for AI Agents
In apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx
around lines 48-64, the current useMemo can produce stale values because it
closes over nested MobX observables and doesn't recompute when those change;
also richFilters should prefer the store value over viewDetails.rich_filters.
Fix by removing the useMemo (or if you must keep it, add the observable store
fields to the dependency array) and compute initialWorkItemFilters from live
values so MobX reactivity works: derive richFilters as storeRichFilters ??
viewDetails?.rich_filters, preserve
displayFilters/displayProperties/kanbanFilters from the store, and only return
undefined when globalViewId is falsy or when a non-static view lacks
viewDetails.

@pushya22 pushya22 merged commit 47f68e3 into preview Sep 22, 2025
8 of 9 checks passed
@pushya22 pushya22 deleted the fix-preset-workspace-view-filters branch September 22, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working requires approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants