You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now @lion/ui is side-effectful: our singletons localize (LocalizeManager instance), overlays (OverlaysManager instance) and icons (IconManager instance) create side effects.
The problems
Side-effectful files do not create optimal bundles
configuring a customized singleton can go wrong if some other file (indirectly) loads a side-effectful file:
On an extension layer, we might want to do:
classMyLocalizeManagerextendsLocalizeManager{// my default cfg }singletonManager.set('@lion/ui::localize::0.x',newMyLocalizeManager());
The above needs to happen before singletonManager.get('@lion/ui::localize::0.x') gets loaded.
But... this can accidentally get loaded by a "chain" like form-core.js-> ValidateMixin -> localize.
We would not have to worry about this if our entry points were side effect free.
Solution proposal
A possible solution for making @lion/ui side effect free is to use singleton-manager as an "injector system":
However, this requires a dev that uses a component like LionInput to separately register singletons on top of his app...
Potentially, this can be solved with:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
SItuation
Right now @lion/ui is side-effectful: our singletons
localize
(LocalizeManager instance),overlays
(OverlaysManager instance) andicons
(IconManager instance) create side effects.The problems
On an extension layer, we might want to do:
The above needs to happen before singletonManager.get('@lion/ui::localize::0.x') gets loaded.
But... this can accidentally get loaded by a "chain" like
form-core.js
->ValidateMixin
->localize
.We would not have to worry about this if our entry points were side effect free.
Solution proposal
A possible solution for making @lion/ui side effect free is to use
singleton-manager
as an "injector system":However, this requires a dev that uses a component like LionInput to separately register singletons on top of his app...
Potentially, this can be solved with:
Which would do:
Now, we have:
Beta Was this translation helpful? Give feedback.
All reactions