Skip to content

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

Open
gjulivan wants to merge 1 commit into
mainfrom
datagrid/fix-filter-lazy-load
Open

gjulivan wants to merge 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

github-actions Bot commented Nov 6, 2026

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 Non-lazy setup() now resets the restored limit with setLimit(undefined) instead of loadMore(). Search only sets the 100-item limit in lazy mode.
packages/shared/widget-plugin-dropdown-filter/src/__tests__/RefFilterStore.spec.ts Replaces the it.todo placeholder with tests for limit handling in lazy and non-lazy mode and for restored-selection captions.
packages/pluggableWidgets/datagrid-dropdown-filter-web/CHANGELOG.md Adds a user-facing "Fixed" entry under Unreleased.
packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts Reorders the size field. This is a generated file.

Skipped (out of scope): dist/, lockfiles

CI: pending: sigridci · unrelated failures: security/snyk (external scanner, 20 tests failed; the Snyk code and license checks passed)


Findings

⚠️ Low — Unrelated change to a generated typings file

File: packages/pluggableWidgets/datagrid-web/typings/DatagridProps.d.ts line 55
Problem: The PR reorders size and minWidthLimit in this generated file, in both ColumnsType and ColumnsPreviewType. It has nothing to do with the filter fix. Repo rules say not to modify generated files, and it adds noise to the diff.
Fix: Revert the file. If the XML order really changed, that belongs in a separate PR.


Questions

  • The changelog is only under datagrid-dropdown-filter-web. Do other widgets use RefFilterStore (for example the Data Grid 2 dropdown-filter in association mode through other packages)? If so, they may also need an entry.

Positives

  • The root cause is clear: the search reaction set the limit in every mode, and the runtime restores the limit when the user returns to the page. The fix is small and targeted.
  • Tests cover both lazy and non-lazy limit behavior, including the restored-limit case and a selection outside the first 100 options.
  • The changelog entry describes user-visible behavior in the repo voice.

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.

1 participant