Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Refreshing a page with Ant Design's useTable's search usage doesn't bring back the value #5798

Closed
linkscope opened this issue Mar 29, 2024 · 5 comments · Fixed by #5912
Assignees
Labels
bug Something isn't working

Comments

@linkscope
Copy link

Describe the bug

Hello,
When following the example from the official documentation Ant Design's useTable's search, I found that when syncWithLocation: true, the url's parameters are not in searchFormProps.initialValues and the onSearch hook is not triggered on the first render, but the parameters are brought in when requesting the API, is this a bug? If it is not an error, please let me know the solution.
Thanks, team

Steps To Reproduce

  1. Follow Ant Design's useTable's search to complete the example.
  2. Enable syncWithLocation: true.
  3. Unable to find url parameter in searchFormProps.initialValues.

Expected behavior

Normal echoing of parameters from the url to the search form

Packages

  • @renfinedev/antd@5.37.4

Additional Context

No response

@linkscope linkscope added the bug Something isn't working label Mar 29, 2024
@BatuhanW
Copy link
Member

Hey @linkscope can you clarify what do you mean here?

but the parameters are brought in when requesting the API

Search isn't expected to be triggered on the first render. Only after user searches something.

@linkscope
Copy link
Author

Hello, @BatuhanW but I did find parameters being carried in the request API, and I'm guessing it might be because Search is still essentially a Filter, which can also be seen as a filter field in the url parameter, and I'm having these two thoughts right now:

  1. Disable Search from participating in syncWithLocal, so that although the state is cleared on each refresh, all parameters are also cleared on request.
  2. Allow syncWithLocal but need to be able to show parameters back in Search when refreshing, can't show parameters back at the moment.

@BatuhanW
Copy link
Member

BatuhanW commented Apr 3, 2024

Hey @linkscope thanks for the clarification! I see the point now. Adding video to give context. We'll discuss it and get back to you.

Screen.Recording.2024-04-03.at.12.01.16.mov

@CapiZerbino
Copy link

CapiZerbino commented May 2, 2024

Hi @BatuhanW. Have this issue resolved? I also have the same problems with video that you attached.

@BatuhanW BatuhanW modified the milestone: May Release May 2, 2024
@aliemir
Copy link
Member

aliemir commented May 2, 2024

Hey @linkscope and @CapiZerbino, this issue is related with our CRM example app. Default value for the search input is missing, even though the filter persists with syncWithLocation, the search value doesn't get reflected in the input. We can easily fix this issue with using the getDefaultFilter helper from @refinedev/core.

If anyone is interested on working this one, we'd be happy to see your contributions 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants