wave icon indicating copy to clipboard operation
wave copied to clipboard

Search throwing error when component gets unmounted

Open phllipo opened this issue 1 year ago • 1 comments

  • @freenow/wave version: ^1.27.0

Relevant code

<Search
      width="400px"
      placeholder={placeholder}
      value={searchQuery}
      onInputChange={(value) => setSearchQuery(value)}
      onClear={() => setSearchQuery('')}
  />

Current Behaviour

When navigating away from a page with Search component, when running the application locally it throws the error shown in the video. In production it just silently puts this error into the console, without breaking anything.

What was expected to happen?

No error thrown

Reproduction

In my case when switching away from a page that has the Search component, the click outside event handler gets triggered, but the ref seems to already be gone from unmounting the parent component. https://user-images.githubusercontent.com/9133431/226910666-973d4b7e-a69c-4d16-9450-7a18a93e8548.mov

phllipo avatar Mar 22 '23 12:03 phllipo

Hi @phllipo would it be possible to create a codesandbox or point me towards any internal links where this issue can be reproduced?

lloydaf avatar Oct 24 '23 10:10 lloydaf