wave
wave copied to clipboard
Search throwing error when component gets unmounted
-
@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
Hi @phllipo would it be possible to create a codesandbox or point me towards any internal links where this issue can be reproduced?