Skip to content

[WC-3635] fix: datagrid filter set limit when no lazy load - #2517

Merged
gjulivan merged 1 commit into
mainfrom
datagrid/fix-filter-lazy-load
Nov 17, 2026
Merged

gjulivan merged 1 commit into
mainfrom
datagrid/fix-filter-lazy-load

Conversation

@gjulivan

@gjulivan gjulivan commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Pull request type

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


Description

Fixes WC-3635. With Use lazy load turned off, the Data Grid 2 drop-down filter (association mode) loaded only part of its options after the user returned to the page with Close page. If the selected option was not in that part, the clear button stayed visible but the caption was empty, and the filter was no longer applied to the grid.

Root cause

In RefFilterStore:

  1. The search reaction called datasource.setLimit(100) in every mode, not only in lazy mode.
  2. After a selection, the search text is cleared. The reaction runs again: it removes the search filter but sets the limit to 100 again. The options list is now "first 100 options".
  3. The Mendix client restores a ListValue limit when the user returns to a page (documented on ListValue.setLimit). The new store instance starts with an empty selectedItems, and the non-lazy setup() called loadMore(), which added 20 to the restored limit. That gives the 100–120 options from the report. A selected option outside that range has no loaded object, so it gets no caption and no filter condition.

Changes

  • widget-plugin-dropdown-filter / RefFilterStore:
    • Search sets the 100-item limit only in lazy mode.
    • In non-lazy mode, setup() resets the limit to the default (no limit) with setLimit(undefined) instead of loadMore(), so a limit restored on page return is removed.
  • Unit tests for RefFilterStore (the spec only had a placeholder before): limit handling in lazy and non-lazy mode, including a restored limit of 100, and the caption of a restored selection outside the first 100 options.
  • Changelog entry for Drop-down filter.

Not in this PR

With lazy loading on, a selected option outside the loaded pages can still lose its caption after returning to the page. The property description already says value restoration is limited in that mode. Fixing it needs a separate fetch of the selected objects by ID.

What should be covered while testing?

Use a Data Grid 2 with a drop-down filter on an association column, Use lazy load = No, and more than 120 options (steps from WC-3635):

  1. Filter the column on an option that sorts beyond the first 120 (for example ZZAccountOutsideTop100).
  2. Check that the grid shows only rows for that option.
  3. Open a row on another page, then use Close page to return.
  4. Expected: the filter still shows the caption, the grid is still filtered, and the options list shows all options.
  5. Regression check with Use lazy load = Yes: options load by page on scroll, and search still works.

@github-actions

This comment has been minimized.

@gjulivan
gjulivan force-pushed the datagrid/fix-filter-lazy-load branch from c495a97 to 114dacb Compare November 6, 2026 08:40
@github-actions

This comment has been minimized.

iobuhov
iobuhov previously approved these changes Nov 10, 2026

@iobuhov iobuhov 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.

LGTM

leonardomendix
leonardomendix previously approved these changes Nov 13, 2026
@gjulivan
gjulivan dismissed stale reviews from leonardomendix and iobuhov via df067b2 November 17, 2026 10:02
@gjulivan
gjulivan force-pushed the datagrid/fix-filter-lazy-load branch from 114dacb to df067b2 Compare November 17, 2026 10:02
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

⚠️ Approved with suggestions — low-severity items only, safe to merge


What was reviewed

File Change
packages/shared/widget-plugin-dropdown-filter/src/stores/RefFilterStore.ts Search only sets the 100-item limit in lazy mode. Non-lazy setup() resets the limit with setLimit(undefined) instead of loadMore().
packages/shared/widget-plugin-dropdown-filter/src/__tests__/RefFilterStore.spec.ts Replaces the it.todo with tests for limit handling in lazy and non-lazy mode, and for the caption of a restored selection.
packages/pluggableWidgets/datagrid-dropdown-filter-web/CHANGELOG.md Adds a user-facing "Fixed" entry.
packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts Reorders size in generated typings. This looks unrelated to the fix.

Skipped (out of scope): dist/, pnpm-lock.yaml

CI: pending: Plan E2E matrix, Run code quality check, sigridci, code/snyk · unrelated failures: security/snyk (external scanner, 16 tests reported, no link to this diff)


Findings

  • packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts:55 — ⚠️ Low: unrelated reorder of generated typings (inline)

Positives

  • The fix addresses the root cause: it stops forcing a 100 limit outside lazy mode and clears the limit the runtime restores on page return.
  • The unit tests replace the placeholder and cover both lazy and non-lazy modes, including a restored limit of 100 and the caption of a selection outside the first 100 options.
  • The changelog entry describes user-visible behavior only. The only consumer of RefFilterStore is datagrid-dropdown-filter-web, which already has the entry.

@gjulivan
gjulivan merged commit 855a9db into main Nov 17, 2026
18 of 20 checks passed
@gjulivan
gjulivan deleted the datagrid/fix-filter-lazy-load branch November 17, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants