simorgh icon indicating copy to clipboard operation
simorgh copied to clipboard

Refactor ATI analytics component

Open jroebu14 opened this issue 4 years ago • 2 comments

We should refactor the ATI analytics component API to accept the minimal props it needs in order to function. We should remove page type conditional logic from the component and each page type should pick and pass down the props from the page data. We should pick the props we need in each page type's getInitialData function.

If we do all this then we can remove all of the duplicated page type splitting param building logic https://github.com/bbc/simorgh/tree/latest/src/app/containers/ATIAnalytics/params

We will also have the ability to pass page components only what they need instead of passing down the full Ares/Optimo response which means having to define prop types for the full response e.g. https://github.com/bbc/simorgh/blob/latest/src/app/models/propTypes/metadata/index.js which makes for hard to follow prop type documentation, includes many prop names that don't make much sense in the context of the component API and includes many props we don't use. An example of passing a page component only what it needs can be found here https://github.com/bbc/simorgh/pull/5566/files

jroebu14 avatar Mar 03 '20 08:03 jroebu14

Related: https://github.com/bbc/simorgh/issues/4738

joshcoventry avatar Aug 12 '21 09:08 joshcoventry

This component is known to be complex and messy. We move the logic behind the BFF and reduce our bundlesize and hydrate a slimmed own analytics component from the BFF view model.

andrewscfc avatar May 04 '22 08:05 andrewscfc