15 Matching Annotations
- Jul 2021
-
blog.appsignal.com blog.appsignal.com
-
What is risky here is that the concern (mixin) knows a lot about the model it gets included in. It is what is called a circular dependency. Song and Album depend on Trashable for trashing, Trashable depends on both of them for featured_authors definition. The same can be said for the fact that a trashed field needs to exist in both models in order to have the Trashable concern working.
-
- Oct 2020
-
-
-
Yeah I see what you're saying. In my case, I had a group of classes that relied on each other but they were all part of one conceptual "module" so I made a new file that imports and exposes all of them. In that new file I put the imports in the right order and made sure no code accesses the classes except through the new interface.
-
-
medium.com medium.com
-
In the many projects I have maintained so far, sooner or later I always run into the same issue: circular module dependencies. Although there are many strategies and best practices on how to avoid circular dependencies. There is very little on how to fix them in a consistent and predictable way.
-
-
Examples of this include: requiring base classes or reading from imported variables that have not been initialized yet.
-
as soon as you have a (indirect) circular dependency, you might be interacting with a half loaded module in your code.
-
-
github.com github.com
-
`Module ${a.id} may be unable to evaluate without ${b.id}, but is included first due to a cyclical dependency. Consider swapping the import statements in ${parent} to ensure correct ordering`
-
-
github.com github.com
-
Specifically, since Root, Rule and AtRule all extend Container, it's essential that Container is evaluated (and therefore, in the context of a Rollup bundle, included) first. In order to do this, input.js (which is the 'gateway' to all the PostCSS stuff) must import root.js, root.js must import rule.js before it imports container.js, and rule.js must import at-rule.js before it imports container.js. Having those imports ensures that container.js doesn't then try to place Root, Rule or AtRule ahead of itself in the bundle.
-
import './at-rule'; // break cyclical dependency deadlock
-
Unfortunately something along these lines will always be necessary when handling these sorts of pathological cyclical dependency cases without using require.
-
-
medium.com medium.com
-
These are fine and do not cause any issues.
-
-
-
spin.atomicobject.com spin.atomicobject.com
-
For simpler patterns, such as A -> B -> A, refactoring may be necessary. Perhaps the modules that live in B could be moved to A. Or, necessary code could be extracted to a C that both A and B reference.
-
-
stackoverflow.com stackoverflow.com