Skip to content

Comments

fix(data-view): preserve filtering on hidden properties#14500

Merged
darkskygit merged 3 commits intotoeverything:canaryfrom
PixPMusic:fix/issue-14036
Feb 23, 2026
Merged

fix(data-view): preserve filtering on hidden properties#14500
darkskygit merged 3 commits intotoeverything:canaryfrom
PixPMusic:fix/issue-14036

Conversation

@PixPMusic
Copy link
Contributor

@PixPMusic PixPMusic commented Feb 23, 2026

Fixes issue #14036 where hiding a column used in filters caused empty table/kanban results.

Root cause: filter evaluation built the row map from visible properties only.

Change: evaluate filters using full property set (propertiesRaw$) so hidden filtered columns still participate.

Added unit regressions for both table and kanban hidden-column filtering behavior.

Verified this does fix the filtering issue for hidden columns:

Screenshot of before and after views of a database with hidden columns and filtering on said column

Summary by CodeRabbit

  • Bug Fixes
    • Fixed filtering in Kanban and Table views so filters evaluate against all properties (including hidden/raw columns), ensuring consistent results regardless of column visibility.
  • Tests
    • Added tests covering filtering behavior with hidden and filtered columns to prevent regressions.

@PixPMusic PixPMusic requested a review from a team as a code owner February 23, 2026 06:40
@github-actions github-actions bot added the test Related to test cases label Feb 23, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

No actionable comments were generated in the recent review. 🎉


ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d24f738 and 2a26d62.

📒 Files selected for processing (1)
  • blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • blocksuite/affine/data-view/src/tests/kanban.unit.spec.ts

📝 Walkthrough

Walkthrough

Filter evaluation in KanbanSingleView and TableSingleView now builds the row property map from all raw properties (propertiesRaw$) instead of only visible properties (properties$). Tests and module exports were updated to expose single-view types and to cover hidden-column filtering scenarios.

Changes

Cohort / File(s) Summary
View manager logic
blocksuite/affine/data-view/src/view-presets/kanban/kanban-view-manager.ts, blocksuite/affine/data-view/src/view-presets/table/table-view-manager.ts
Changed isShow to iterate propertiesRaw$ (all properties) when constructing rowMap used for filter evaluation instead of iterating visible properties$.
Public exports
blocksuite/affine/data-view/src/view-presets/kanban/kanban-view-manager.js, blocksuite/affine/data-view/src/view-presets/table/table-view-manager.js
Added KanbanSingleView and TableSingleView to the modules' export surfaces so tests import them as public symbols.
Tests
blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts, blocksuite/affine/data-view/src/__tests__/table.unit.spec.ts
Updated imports to include FilterGroup and SingleView types; added/adjusted tests exercising filtering behavior when some columns are hidden and when hidden columns match filters.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble through props, both shown and shy,
Counting every field beneath the sky.
Kanban and Table hum a filtering tune,
Hidden columns counted by the light of the moon. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main fix: preserving filtering functionality when properties are hidden, which directly addresses the root cause documented in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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.

🧹 Nitpick comments (2)
blocksuite/affine/data-view/src/__tests__/table.unit.spec.ts (1)

100-144: Good regression test — mirrors the kanban test for consistency.

Same feedback as the kanban test: consider adding a negative case (hidden column value doesn't match filter → isShow returns false) to fully cover the filtering path.

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blocksuite/affine/data-view/src/__tests__/table.unit.spec.ts` around lines
100 - 144, Add a negative test mirroring the existing "evaluates filters with
hidden columns" case: create a FilterGroup that checks status is "Done", but
make the statusProperty.jsonValue$.value something else (e.g., "In Progress"),
keep properties$ showing only title and propertiesRaw$ containing title and
status, and assert TableSingleView.prototype.isShow.call(view, 'row-1') returns
false; this ensures the hidden-column filter path is covered for non-matching
values.
blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts (1)

277-321: Good regression test for the hidden-column filtering fix.

The test correctly simulates a hidden column scenario and validates that isShow evaluates the filter using propertiesRaw$ rather than properties$.

Consider adding a complementary test case where the hidden column's value does not match the filter (e.g., value: 'In Progress'), asserting isShow returns false. This would confirm both the positive and negative paths through the filter with hidden columns.

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts` around lines
277 - 321, Add a complementary unit test in the same describe('filtering') block
that mirrors the existing "evaluates filters with hidden columns" case but sets
the hidden statusProperty's jsonValue$.value to 'In Progress' (so it does not
match the filter) and assert that KanbanSingleView.prototype.isShow.call(view,
'row-1') returns false; reuse the same filter variable and view setup but change
statusProperty value to 'In Progress' and keep properties$ containing only
titleProperty and propertiesRaw$ containing both properties to ensure isShow
evaluates against propertiesRaw$.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts`:
- Around line 277-321: Add a complementary unit test in the same
describe('filtering') block that mirrors the existing "evaluates filters with
hidden columns" case but sets the hidden statusProperty's jsonValue$.value to
'In Progress' (so it does not match the filter) and assert that
KanbanSingleView.prototype.isShow.call(view, 'row-1') returns false; reuse the
same filter variable and view setup but change statusProperty value to 'In
Progress' and keep properties$ containing only titleProperty and propertiesRaw$
containing both properties to ensure isShow evaluates against propertiesRaw$.

In `@blocksuite/affine/data-view/src/__tests__/table.unit.spec.ts`:
- Around line 100-144: Add a negative test mirroring the existing "evaluates
filters with hidden columns" case: create a FilterGroup that checks status is
"Done", but make the statusProperty.jsonValue$.value something else (e.g., "In
Progress"), keep properties$ showing only title and propertiesRaw$ containing
title and status, and assert TableSingleView.prototype.isShow.call(view,
'row-1') returns false; this ensures the hidden-column filter path is covered
for non-matching values.

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.

🧹 Nitpick comments (1)
blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts (1)

277-365: Extract shared filter and titleProperty mocks to reduce duplication.

Both test cases contain an identical filter definition (lines 279–293 and 323–337) and an identical titleProperty mock (lines 295–302 and 339–346). Hoisting these to shared consts within the describe('filtering', ...) scope removes copy-paste drift risk if the filter structure ever changes.

♻️ Proposed refactor
  describe('filtering', () => {
+   const sharedFilter: FilterGroup = {
+     type: 'group',
+     op: 'and',
+     conditions: [
+       {
+         type: 'filter',
+         left: { type: 'ref', name: 'status' },
+         function: 'is',
+         args: [{ type: 'literal', value: 'Done' }],
+       },
+     ],
+   };
+
+   const titleProperty = {
+     id: 'title',
+     cellGetOrCreate: () => ({ jsonValue$: { value: 'Task 1' } }),
+   };
+
    it('evaluates filters with hidden columns', () => {
-     const filter: FilterGroup = {
-       type: 'group',
-       op: 'and',
-       conditions: [
-         {
-           type: 'filter',
-           left: { type: 'ref', name: 'status' },
-           function: 'is',
-           args: [{ type: 'literal', value: 'Done' }],
-         },
-       ],
-     };
-
-     const titleProperty = {
-       id: 'title',
-       cellGetOrCreate: () => ({ jsonValue$: { value: 'Task 1' } }),
-     };
      const statusProperty = {
        id: 'status',
        cellGetOrCreate: () => ({ jsonValue$: { value: 'Done' } }),
      };

      const view = {
-       filter$: { value: filter },
+       filter$: { value: sharedFilter },
        properties$: { value: [titleProperty] },
        propertiesRaw$: { value: [titleProperty, statusProperty] },
      } as unknown as KanbanSingleView;

      expect(KanbanSingleView.prototype.isShow.call(view, 'row-1')).toBe(true);
    });

    it('returns false when hidden filtered column does not match', () => {
-     const filter: FilterGroup = {
-       type: 'group',
-       op: 'and',
-       conditions: [
-         {
-           type: 'filter',
-           left: { type: 'ref', name: 'status' },
-           function: 'is',
-           args: [{ type: 'literal', value: 'Done' }],
-         },
-       ],
-     };
-
-     const titleProperty = {
-       id: 'title',
-       cellGetOrCreate: () => ({ jsonValue$: { value: 'Task 1' } }),
-     };
      const statusProperty = {
        id: 'status',
        cellGetOrCreate: () => ({ jsonValue$: { value: 'In Progress' } }),
      };

      const view = {
-       filter$: { value: filter },
+       filter$: { value: sharedFilter },
        properties$: { value: [titleProperty] },
        propertiesRaw$: { value: [titleProperty, statusProperty] },
      } as unknown as KanbanSingleView;

      expect(KanbanSingleView.prototype.isShow.call(view, 'row-1')).toBe(false);
    });
  });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts` around lines
277 - 365, Duplicate filter and titleProperty mocks are repeated in the two
tests; hoist them into shared constants inside the describe('filtering', ...)
scope (e.g., const sharedFilter = { ... } and const sharedTitleProperty = { ...
}) and replace the inline definitions in both it(...) blocks with references to
sharedFilter and sharedTitleProperty; keep the per-test statusProperty
definitions local and continue to call
KanbanSingleView.prototype.isShow.call(view, 'row-1') as before.
ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a7cc31a and d24f738.

📒 Files selected for processing (2)
  • blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts
  • blocksuite/affine/data-view/src/__tests__/table.unit.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • blocksuite/affine/data-view/src/tests/table.unit.spec.ts
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@blocksuite/affine/data-view/src/__tests__/kanban.unit.spec.ts`:
- Around line 277-365: Duplicate filter and titleProperty mocks are repeated in
the two tests; hoist them into shared constants inside the describe('filtering',
...) scope (e.g., const sharedFilter = { ... } and const sharedTitleProperty = {
... }) and replace the inline definitions in both it(...) blocks with references
to sharedFilter and sharedTitleProperty; keep the per-test statusProperty
definitions local and continue to call
KanbanSingleView.prototype.isShow.call(view, 'row-1') as before.

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.07%. Comparing base (ef6717e) to head (2a26d62).
⚠️ Report is 1 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #14500      +/-   ##
==========================================
- Coverage   57.46%   57.07%   -0.39%     
==========================================
  Files        2860     2860              
  Lines      154583   154583              
  Branches    23368    23243     -125     
==========================================
- Hits        88829    88227     -602     
- Misses      62845    63348     +503     
- Partials     2909     3008      +99     
Flag Coverage Δ
server-test 75.14% <ø> (-0.81%) ⬇️
unittest 34.05% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@darkskygit darkskygit added this pull request to the merge queue Feb 23, 2026
@darkskygit darkskygit removed this pull request from the merge queue due to a manual request Feb 23, 2026
@darkskygit darkskygit merged commit fb9f49b into toeverything:canary Feb 23, 2026
58 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Related to test cases

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants