-
Notifications
You must be signed in to change notification settings - Fork 42
WIP FOR DISCUSSION: Conditional Load for external dependency #2885
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
base: master
Are you sure you want to change the base?
Conversation
Added new Component "ConditionalLoad" which can work analogously to Pluggable This should be considered for stripes-core or otherwise
|
Note... this doesn't seem to work quite as expected currently, I think the approach is still up for debate, but something is breaking WRT the dynamic import of modules in the workspace :( |
…ive the possible options ahead of time so webpack knows what it may need to bundle. I don't love this fix tbh
…s before... there may be benefits to that work outside of dynamic webpack loading
|
Of course, the alternative is to use I thought it worth a conversation though, at least |
|



Purpose
A recent PR brought 'ui-service-interaction' in as a peer dependency to ui users. In normal operation for FOLIO this would simply resolve itself easily, as both users and ui-service-interaction are parts of the "flower release".
However the intention with NumGen (the feature implemented by UIU-2729) was never intended to bring extra locking dependencies into the frontend and thus entire build process, rather act as an OPTIONAL feature set for modules to implement how they see fit.
Due to constraints when building
ui-service-interactionthe implementations themselves did not end up being completed by me beyond a very small proof-of-concept, and so some of the architectural nuance ended up being lost.Approach
I had envisioned something similar to "Pluggable", but instead as a new pattern where modules could surface "public" components to be brought in by other modules should they wish. The "peer dependency" is equivalent to an optional okapi dependency (whichh should ALSO be defined), and thus it should be treated as such.
To that end I propose something akin to Pluggable: ConditonalLoad (Name absolutely up for debate, I am not the best at naming things)
This works utilising Lazy loading to catch imports at runtime, meaning that functionality for flower releases need not be affected, but any implementations of Users without wanting to bring in service interaction and the required interface dependencies of that can do so.
TODOS and Open Questions
Does this belong in stripes-core?
My gut says that such a feature absolutely belongs in stripes core, this PR simply acts as a place to begin that conversation.
Is there anything else required to support this "public" component pattern?
I know that some developers, especially @zburke have had questions about this pattern from the very start. However it has now been ratified by the tech council and so the genie is basically out of the bottle. It is definitely on me to a large extent that the fallout of this design was not thoroughly considered with measures like this put in place, but I believe this 100% MUST be considered for functionality such as UIU-2729 in Trillium in such a key module as users
Pre-Merge Checklist
Before merging this PR, please go through the following list and take appropriate actions.