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]: SearchInput not updating if parent's data changes more than once #501

Open
1 task done
rahulbarwal opened this issue Jun 13, 2023 · 0 comments
Open
1 task done
Assignees

Comments

@rahulbarwal
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

This came up when I was working on ticket, where we want filters and search input to clear on landing the templates page again after the first time.

This is occurring because, the SearchInput is not rendering again in :
https://github.com/appsmithorg/design-system/blob/release/packages/design-system/src/SearchInput/SearchInput.tsx

And can be fixed by adding this to SearchInput:

useEffect(() => {
      setValue(props.value || "");
    }, [props.value]);

Not sure if this is the case with other types of inputs as well

Steps To Reproduce

I noticed that was not picking values from props once it got rendered. Flow on my UI was like this:

  1. I went to /templates page, entered a search query
  2. From the filtered list of templates clicked on one of them, reached template detail page.
  3. from here I click back(& expect the RESET_TEMPLATE_FILTER action to run on mount)
  4. It does, but just before that, store already had previously entered search query
    a. with this value the input rendered itself
    b. after my action ran, it emptied the query from store
    c. but input did not clear it

Public Sample App

No response

Version

Appsmith v1.9.22-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants