Automattic / bugomattic

Bugomattic is a tool that guides bug reporters to the right actions within large, complex organizations
GNU General Public License v2.0
6 stars 0 forks source link

[Bug]: Duplicate search term doesn't sync between input and redux state when using URL history #93

Closed dpasque closed 1 year ago

dpasque commented 1 year ago

Quick summary

The duplicate search term doesn't stay in sync between the redux and input when parsing from the URL history.

You see two main bugs, both with the same root cause:

  1. If you load from a URL, the search term is set in the redux store, but not he actual search input
  2. When you use forward/back, we change the redux state, but not the input value

Both are because the local state of the debounced search is completely decoupled from the redux values.

Steps to reproduce

  1. Add a search term and search
  2. Refresh the page with the new URL -- no search term!

Browser

No response

Other notes

What we need to do is...

  1. Make the DebouncedSearch optionally take in "controlled" state values (searchTerm, setSearchTerm) in the props. If we provide those, use those instead of the local state values.
  2. Take the parent duplicate search component and sync the local state with the redux value