Skip to content

feat(antd): add onParse support to useTable and useSimpleList#7473

Open
arunkumarmeda27 wants to merge 3 commits into
refinedev:mainfrom
arunkumarmeda27:feat/on-parse-antd-filters
Open

feat(antd): add onParse support to useTable and useSimpleList#7473
arunkumarmeda27 wants to merge 3 commits into
refinedev:mainfrom
arunkumarmeda27:feat/on-parse-antd-filters

Conversation

@arunkumarmeda27

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

When using useTable or useSimpleList from @refinedev/antd with syncLocation: true and an search form via onSearch, the reverse mapping (URL / Table Filters -> Form Fields) uses a simple field-matching logic. This causes two main limitations:

  1. All values restored from the URL filters are strings (e.g., number category IDs become strings), causing issues in components like Antd Select.
  2. Complex objects (e.g. Ant Design RangePicker arrays constructed from splitting a filter into gte and lte constraints) cannot be reconstructed.
  3. In addition, useSimpleList search forms had no automated synchronization with URL filters at all.

What is the new behavior?

We introduced an optional onParse parameter to useTableProps and useSimpleListProps:

  • onParse?: (filters: CrudFilters) => TSearchVariables;

If onParse is provided, the hook calls it during location synchronization and sets the return value directly on the Ant Design form instance, allowing developers to customize how filters are transformed back into form values (e.g., type casting or merging filters).

Also, search form location syncing was implemented for useSimpleList using the same logic as useTable.

Notes for reviewers

The feature has been fully covered by unit tests in both useTable.spec.tsx and useSimpleList.spec.ts. A changeset file (.changeset/add-onparse-to-antd.md) has been created for versioning.

@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7f69ea2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/antd Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant