I am still pretty new to SCA development and just ...
# suitecommerce
m
I am still pretty new to SCA development and just want to confirm this isn't a bad design pattern that I will regret. The problem: Want to minimize calls back to get session information and share it with other modules/views. The solution: 1. Once session information is fetched in one modules entrypoint an event is triggered and session information is attached. 2. In another module that wants to hide a field based on session values from the other module's session I have the following.
Copy code
const session = {
    suiteletUrl: environment.getConfig("ItemAvailability.SuiteletUrl")
    , isEditOrder: false        
};
create session object and pass it into the view.
Copy code
return new ItemAvailabilityView({container: container, session: session});
I have a listener for the event that will receive session information after it's fetched from the other module and change a session property and render the layout again.
Copy code
cart.cancelableOn("after:editOrder.session", function(return_session) {
    session.isEditOrder = return_session.isEditOrder;
    container.getLayout().render();
});
Is there a downside to this?