-
Notifications
You must be signed in to change notification settings - Fork 4
cp-363: Scroll to selected chat after reloading #516
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
base: development
Are you sure you want to change the base?
Conversation
| useEffect(() => { | ||
| if (chatsDataStatus === DataStatus.FULFILLED) { | ||
| setIsChatsLoaded(true); | ||
| } | ||
| }, [chatsDataStatus, setIsChatsLoaded]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need a state for this? Can't we simply check like this?
const isChatsLoaded = chatsDataStatus === DataStatus.FULFILLEDThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HIMDanny We can't. Scroll to the selected card should be only on first chats loading, because then data status will change on every search request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now I see, thanks for clarification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, we also can use ref for this to not cause a rerender after setIsChatLoaded(true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HIMDanny What do you mean by saying use ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, now I am not sure whether it will work)
Done:
2023-09-30.13-16-42.mp4