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

feat(BidirectionalTool): Update tool data on every modified event of … #882

Merged
merged 8 commits into from
Mar 14, 2019

Conversation

galelis
Copy link
Member

@galelis galelis commented Mar 7, 2019

Issue

  • Once tool handlers are modified we trigger a MEASUREMENT_MODIFIED event but it does not get toolData updated. So other components that listen to it does not get properly updated.

Fix

  • Wait image render and submit the modified event with the toolData updated.
  • Also moved the tool data calculation into another file/function.

@codecov
Copy link

codecov bot commented Mar 7, 2019

Codecov Report

Merging #882 into master will increase coverage by 0.24%.
The diff coverage is 60.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #882      +/-   ##
==========================================
+ Coverage   10.73%   10.97%   +0.24%     
==========================================
  Files         212      213       +1     
  Lines        6848     6853       +5     
  Branches     1089     1089              
==========================================
+ Hits          735      752      +17     
+ Misses       5152     5146       -6     
+ Partials      961      955       -6
Impacted Files Coverage Δ
...on/bidirectionalTool/moveHandle/touchMoveHandle.js 0% <0%> (ø) ⬆️
...otation/bidirectionalTool/moveHandle/moveHandle.js 0% <0%> (ø) ⬆️
...ols/annotation/bidirectionalTool/renderToolData.js 0% <0%> (ø) ⬆️
.../annotation/bidirectionalTool/addNewMeasurement.js 0% <0%> (ø) ⬆️
...Tool/utils/calculateLongestAndShortestDiameters.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 663c3c9...f620ed0. Read the comment docs.

@galelis galelis force-pushed the fix-bidirectional-sync branch 3 times, most recently from 37a51c4 to 023be5f Compare March 8, 2019 05:34
@galelis galelis requested a review from dannyrb March 8, 2019 15:47
@@ -50,6 +51,33 @@ export default function(
EVENTS.MEASUREMENT_MODIFIED,
modifiedEventData
);

const measurementModifiedHandler = () => {
Copy link
Member

Choose a reason for hiding this comment

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

I think the current moveHandle (generic) accomplishes this by setting the tool's annotation data to invalidated. Then, in the render loop, if we see invalidated, we can run the calculate method to grab updated data and inform measurement modified subscribers.

This has the advantage of only needing to call the method in one place.

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 have done a small refactor, I am now just calculating and triggering the measurement modified.
The measurement table uses this measurement modified to update the table. I will think later on something cleaner for other annotationTools.

Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

The only stop for me on this is the unit test language, and we can discuss it further as it's mostly a matter of preference. My hope is that the title's I've suggested make it easier to grok, at a glance, the expected behavior of what we're testing.

All of the other implementation details are okay as-is, just floating alternative ideas.

@galelis galelis requested a review from dannyrb March 14, 2019 05:57
@dannyrb
Copy link
Member

dannyrb commented Mar 14, 2019

It looks like CI is failing. Can you sync it with the base branch and resolve any issues? Feel free to ping me if the mistake/hold-up is on my end.

@galelis galelis force-pushed the fix-bidirectional-sync branch from c71c76b to e90a7ad Compare March 14, 2019 14:57
@galelis
Copy link
Member Author

galelis commented Mar 14, 2019

@dannyrb Just rebased my branch.
There is an issue with the tests, because our docker image uses latest version of NodeJs (11.11.0) and its causing issues with Jest.

@dannyrb
Copy link
Member

dannyrb commented Mar 14, 2019

Do the tests pass when you change:

- image: circleci/node:latest

To:

- image: circleci/node:10.0.0

@dannyrb
Copy link
Member

dannyrb commented Mar 14, 2019

Hmm.. Apparently not. My next best guess would be a cache issue with packages then? You could try commenting out the save/restore cache portions of the CI config?

I'll look into this issue more next week if you don't have the time right now.

@galelis galelis force-pushed the fix-bidirectional-sync branch from 270d8ca to f620ed0 Compare March 14, 2019 16:33
@dannyrb
Copy link
Member

dannyrb commented Mar 14, 2019

Thanks, @galelis!

@dannyrb dannyrb merged commit 7c38bec into master Mar 14, 2019
@dannyrb
Copy link
Member

dannyrb commented Mar 14, 2019

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dannyrb dannyrb deleted the fix-bidirectional-sync branch March 28, 2019 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants