chat: fix infinite refetch bug with scrollTo, fix chat bug, navigate to thread parent #3113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes LAND-1364, the scrollTo refetch bug issue. This was caused by the use of the
msg
param in the case of a message we wanted to highlight within a thread. We used the same param for scrollTo in the ChatWindow, and since we couldn't find the scrollTo in the existing messages (and never would since it exists outside of the main chat window, in a thread) the new useEffect that fixed search was firing in a loop. This was fixed by changing the url param for finding a thread message tothread-msg
.Also fixes LAND-1331 by adding the useEffect back in, this time with a new dependent variable that uses either the parent ID in the router or the id from the
msg
param. This same variable is also used to scroll to the thread parent in the main window, which is something that wasn't working on mainnet/develop before. I don't think we have an issue for this one.