Skip to content

[BUG] RangePicker in Table Search Form: URL restoration causes incorrect value type #6714

Open
@gensmusic

Description

@gensmusic

Describe the bug

When using refine's Table component combined with a search form that includes a RangePicker, with URL synchronization enabled (syncWithLocation), an issue arises. When the URL (which contains the search query parameters) is pasted into the browser, the initial value for the RangePicker is restored as a single string instead of an array. Then you will get blank page and an error in console.

It's very easy to reproduce as follows.

Image Image

Steps To Reproduce

  1. create example talbe antd table filter by running npm create refine-app@latest -- --example table-antd-table-filter
  2. start the project yarn dev
  3. In Filters, pick any date in Created At, then click.
  4. copy the url in the browser, then paste it and open(or just click Refresh button), you will get a blank page and an error in console.
Image Image

Expected behavior

page should be open and Created At filter is set ok.

Packages

"dependencies": {
"@ant-design/icons": "^5.5.1",
"@refinedev/antd": "^5.45.3",
"@refinedev/cli": "^2.16.44",
"@refinedev/core": "^4.57.7",
"@refinedev/react-router": "^1.0.1",
"@refinedev/simple-rest": "^5.0.10",
"@uiw/react-md-editor": "^3.19.5",
"antd": "^5.17.0",
"dayjs": "^1.10.7",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router": "^7.0.2"
},
"devDependencies": {
"@types/node": "^18.16.2",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "^5.4.2",
"vite": "^5.1.6"
}
}

Additional Context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions