Skip to content
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

Decouple ribbon from comparison table revisions #1844

Merged
merged 3 commits into from
Jun 7, 2022
Merged

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Jun 6, 2022

This PR fixes two bugs:

  1. Ribbon not being rendered correctly if there are no images sent to the webview.
  2. Revisions in the ribbon being reordered if the comparison table is reordered.

Demo

Screen.Recording.2022-06-07.at.10.29.03.am.mov

@mattseddon mattseddon added the bug Something isn't working label Jun 6, 2022
@mattseddon mattseddon self-assigned this Jun 6, 2022
@mattseddon mattseddon force-pushed the update-plot-message branch from 48a32ea to 80c64c4 Compare June 6, 2022 20:41

useEffect(() => {
setOrder(pastOrder => performOrderedUpdate(pastOrder, revisions, reorderId))
}, [revisions])
Copy link
Member Author

Choose a reason for hiding this comment

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

@sroy3 I copied the pattern that we had elsewhere. Does this work for you?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't do that, it'll keep re-ordering with the comparison table? If so, that's great. If not, then I don't see why we need it.

@mattseddon mattseddon marked this pull request as ready for review June 7, 2022 00:42

useEffect(() => {
setOrder(pastOrder => performOrderedUpdate(pastOrder, revisions, reorderId))
}, [revisions])
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't do that, it'll keep re-ordering with the comparison table? If so, that's great. If not, then I don't see why we need it.

@@ -50,7 +59,7 @@ export const Ribbon: React.FC<RibbonProps> = ({ revisions }) => {
appearance="secondary"
/>
</li>
{revisions.map(revision => (
{reorderObjectList(order, revisions, reorderId).map(revision => (
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have already been done by the useEffect above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do I need to remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't think that performOrderedUpdate mutated the original array?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I thought it was the same function twice. It's fine.

@codeclimate
Copy link

codeclimate bot commented Jun 7, 2022

Code Climate has analyzed commit 7a33da1 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 96.9% (0.0% change).

View more on Code Climate.

@sroy3 sroy3 merged commit 3ba2b97 into main Jun 7, 2022
@sroy3 sroy3 deleted the update-plot-message branch June 7, 2022 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants