-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: edge deletion behavior cyclic import structure #89
Conversation
Codecov Report
@@ Coverage Diff @@
## master #89 +/- ##
==========================================
+ Coverage 94.61% 94.70% +0.08%
==========================================
Files 60 62 +2
Lines 1523 1548 +25
Branches 167 166 -1
==========================================
+ Hits 1441 1466 +25
Misses 80 80
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
While this solves the current dependency cycle, it doesn't solve the overall problem of cycles. The solution also adds extra complexity to inboundEdges
in order to break the current cycle.
Since the entity
repo is smaller than www
, this might be a good place to try the prescribed solution in the article you linked, adding an index/internal.ts
and have everything import from that intermediate file. This way, modules are always loaded in the same order every time.
The package Other solutions were considered, though:
|
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.
This solution seems good and should hold up. There is a cyclic relationship between entity types, but it doesn't need to be resolved all at once (hence the new thunk).
Why
The way this was created led to import cycles in top level module exports, causing them to resolve as undefined. (as described in https://medium.com/visual-development/how-to-fix-nasty-circular-dependency-issues-once-and-for-all-in-javascript-typescript-a04c987cf0de)
How
Make one end of the reference cycle a function to prevent necessary resolution at module import time.
Test Plan
yarn integration
, ensure they fail with the following:yarn integration
and ensure the tests now pass.