Closed
Description
Latest list of circular dependencies:
- Plots < --- > Annotations
- Plots < --- > Legend
- Plots < --- > Axes (the only
Plots
calls inaxes.js
aretraceIs
) - Plots < --- > plotApi
- plotApi < --- > Annotations
- plotApi < --- > Shapes
- plotApi < --- > Titles
- plotApi < --- > Fx
- plotApit < --- > Legend
Possible partial solutions:
- Make a component registry and register the components (e.g. Annotations, Shapes, Titles, Fx, Legend), so
plot_api.js
doesn't have to require the full component modules (similar to trace and subplot modules). Blocking: we'll need a centralized api for the component module, e.g. all component modules should have adraw
method and possible andinit
method. - Use a more OO pattern (in the long term). Attach
relayout
andrestyle
to a plot object so that files requiringplot_api.js
(e.g Annotations, Shapes and Fx) can usegd.relayout()
instead ofplotApi.relayout(gd, ...)
.
Metadata
Metadata
Assignees
Labels
No labels
Activity
etpinard commentedon Feb 17, 2017
The World Calendar push of #1220 added a new circular dependency pattern to
src/
:as
src/registry.js
requiresLib
for andsrc/lib/dates.js
requiresRegistry
to use the calendars component methods.To solve this, we can either:
lib/dates.js
a component module (as one could argue thatsrc/lib/
files should have to use the registry)registry.js
instead of requiring the wholeLib
modulebump MAX_ALLOWED_CIRCULAR_DEPS to 18
alexcjohnson commentedon Feb 22, 2017
In the course of #1403 I made some circular deps involving
Lib
. In the short term I'm fixing these by breaking upLib
and just requiring the pieces I need, but longer term perhaps the right solution is to only allow things inLib
that do notrequire
code from elsewhere in plotly.js. That would make it safe to importLib
anywhere, without forcing us to break it into a million little files. Would be a bit of an effort though...etpinard commentedon Nov 17, 2017
Refer to PR #2032 for the most up-to-date findings.