Describe the bug
There is a problem with focusItem functionality in useMessages hook - when receiving empty search results and trying to focus undefined item - the state doesn't change and old focused item is still being focused.
To Reproduce
Steps to reproduce the behavior:
Set some search result.
See that the first search result is being focused.
Set search result to empty array.
See that previously focused item is still being focused.
Expected behavior
It is expected to unfocus that item.
Possible solution
Function focusItem should rerender when receiving undefined item and an old focused item existed.
Describe the bug There is a problem with
focusItem
functionality inuseMessages
hook - when receiving empty search results and trying to focusundefined
item - the state doesn't change and old focused item is still being focused.To Reproduce Steps to reproduce the behavior:
Expected behavior It is expected to
unfocus
that item.Possible solution Function
focusItem
should rerender when receivingundefined
item and an old focused item existed.