SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 389 forks source link

Avoid stacked outlets for position REPLACE and introduce fallback property #8209

Open Platonn opened 4 years ago

Platonn commented 4 years ago

Since https://github.com/SAP/spartacus/issues/3462 , all the defined outletRefs for a specific outlet position (REPLACE, BEFORE or AFTER) are stacked. While this is ok for BEFORE and AFTER, it causes some limitations in flexibility when it comes to REPLACE.

For example when we delcare cxOutletRef in our library (i.e. to customize cells of the component cx-table), customer can't overwrite our default content with his one, but only stack his one besides our.

While leaving stacked behavior for positions BEFORE and AFTER, now we should stop it for REPLACE.

However this may lead to problem with priority - which competitor should replace the outlet when there are two: our default one and the customer's one. That's why we introduce a fallback property to the cxOutletRef, so our default template can display only when there are not custom ones declared.

Platonn commented 4 years ago

It affects my-company views that use cx-table, so setting milestone 2.1

Platonn commented 4 years ago

The problem was solved differently in My Company (using new introduced table cell renderers). So now the issue becomes less of a priority. Athough it may come back urgent when we use outlets actively for cross-libs extendability (i.e. product configuration feature providing a default outlet to the generic cart list item component).

ChristophHi commented 3 years ago

Would improve extensibility for product configurators much. The product-configurator feature lib provides implementations for CartOutlets.ITEM_DETAILS e.g. for displaying the configuration summary. Projects want to change that display, which is rather cumbersome at this point, because non-product-configurator related cart entry content needs to be copied as well