Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Conversation

arniebradfo
Copy link
Collaborator

🗣 Description

The Comments virtualized list scrolling was unusable. It jumped all over the place while scrolling. There were 2 issues

🧪 Testing

Some of the Comment list code was edited, and is pretty complex in terms of queries (TODO: should be simplified). This means that we need to test everywhere comments are present

  • All / Comments / All Comments
  • All / Comments / parser comments
  • All / Comments / users
  • All / Comments / #Tags
  • Server / Comments
  • Host / Comments
  • Beacon / Comments
  • presentation slides

Features

  • are the correct comments rendering? on the correct list
  • sorting
  • reloading into comment pages

📷 Screenshots (if appropriate)

Comment on lines 186 to 196
useEffect(() => {
// What does this do?
if (store.router.params.currentItem === 'comments_list' && store.router.params.currentItemId) {
const filteredData = commentsData?.presentationItems.find(
const currentPresentationItem = presentationItemsData?.presentationItems.find(
(item) => item.id === store.router.params.currentItemId
);
store.campaign?.setCommentsList({
commandGroupIds: Array.from(filteredData?.commandGroupIds || []),
commandGroupIds: Array.from(currentPresentationItem?.commandGroupIds || []),
});
}
}, [store.campaign.commentsList.commandGroupIds, store.router.params.currentItem, store.router.params.currentItemId]);
}, [presentationItemsData, store.router.params.currentItem, store.router.params.currentItemId]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharplessHQ, can you sort out what this useEffect is for? and also the required presentationItemsData? Could this be removed or is it important? Could we write a comment to explain the purpose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to render the page correctly under a specific comment type. Try refresh the page or sorting without this useEffect.

Copy link
Contributor

@sharplessHQ sharplessHQ Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Sorting under a specific type won't work with this change.'

(As we talked yesterday, this dependency change would cause an issue and i used the circular way TEMPORARILY since i couldn't find another way to make it work at that moment. But i forgot what the issue was... Now i remember when checking your PR, it's the sorting under a specific type.)

Copy link
Collaborator Author

@arniebradfo arniebradfo Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, Thanks. I will try to resolve it.

Copy link
Collaborator Author

@arniebradfo arniebradfo Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined the 4 useQuery into 2 that provide different calls based on the requested state. I also removed the global store.campaigns.commentList because it is local to the Comments.tsx component.

BUT, this definitely needs review. @sharplessHQ and @GoldingAustin please look at the final state of Comments.tsx and see if it makes sense to combine these useQueries in this way.

I've tested and everything seems to work fine. All ways returns the correct list, correctly sorted, and on initial load.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good and works right to me. I was planning to combine after i finished up the second set of queries, but then that refresh/sorting thing i mentioned above made me concerned combining might cause more issues. I guess my 2 separate sets of queries are the thing causing this issue...
Thanks for fixing this! :-)
My only comment is about the ProgressBar bug^

@sharplessHQ sharplessHQ requested a review from GoldingAustin June 8, 2023 16:25
@ccarpenter28
Copy link
Contributor

ccarpenter28 commented Jun 8, 2023

Using the gt.redeye file, I clicked into Explorer Mode, then the Comments tab. If you click on Favorited Comments, which has 0, the page looks like it's continuously loading but never does. We saw this in a previous PR and it was resolved, so whatever fixed that behavior must have been affected. No console errors.

Comment on lines 173 to 179
{commandGroupIdData?.commandGroupIds?.length === 0 ? (
isLoading ? (
<ProgressBar intent={Intent.PRIMARY} />
) : (
store.campaign.commentsList.commandGroupIds.map((commandGroupId) => (
<CommentGroup
cy-test="comment-group"
key={commandGroupId}
commandGroupId={commandGroupId}
toggleNewComment={state.toggleNewComment}
newComment={state.newComment}
expandedCommandIDs={state.expandedCommandIDs}
removeExpandedCommandID={state.removeExpandedCommandID}
/>
))
<MessageRow>No comments</MessageRow>
)
) : data?.commandGroupIds.length === 0 ? (
<MessageRow>No comments</MessageRow>
) : isLoading ? (
<ProgressBar intent={Intent.PRIMARY} />
) : (
Copy link
Collaborator Author

@arniebradfo arniebradfo Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the gt.redeye file, I clicked into Explorer Mode, then the Comments tab. If you click on Favorited Comments, which has 0, the page looks like it's continuously loading but never does. We saw this in a previous PR and it was resolved, so whatever fixed that behavior must have been affected. No console errors.

  • Fix this: caused by the new render logic in the Comments return. It doesn't account for if there are 0 comments.

@sharplessHQ sharplessHQ self-requested a review June 13, 2023 17:11
@arniebradfo arniebradfo merged commit d4a0091 into develop Jun 13, 2023
@arniebradfo arniebradfo deleted the BLDSTRIKE-594-Comments-VirtualizedList-Bugs branch June 13, 2023 17:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants