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
Is your feature request related to a problem? Please describe.
Arising from the meeting in #884: we've identified that one day we may have to support more than just 'canonical' and 'AMP'.
To prevent lock-in to binary platform delivery, we should phase out our use of the isAmp boolean and instead refer to a platform string which may have the value 'canonical', 'AMP' or something else in the future.
Notes from Jim:
So at the moment the assumption is that FIA and Apple News stay with Syndication
However we may want to render a syndicatable HTML version of the article - this is something Bogdan and I have discussed a little
so it does make sense to consider a world where we are rendering more than two variants
Describe the solution you'd like
Create the PlatformContext, and use PlatformContex.Provider in the Article container & PlatformContainer.Consumer in the Image container. A POC can be seen here: #878.
Rather than passing isAmp as props, pass platform via the context. Almost everywhere in our code where we refer to isAmp, we should make a change.
That said, in containers which need AMP logic, there's nothing stopping us from doing isAmp = platform === 'amp' and then referring to isAmp in the rest of the file.
Describe alternatives you've considered
The alternative is passing the platform as a prop down nested components - quickly gets messy.
Another alternative is some centralised state (eg Redux), but this isn't necessary at this time.
The alternative is to keep things the way they are - but could become a maintenance nightmare if that 3rd platform becomes a requirement in the future! Making the change to platform means we'd have to make changes to a minimal number of files.
Is your feature request related to a problem? Please describe.
Arising from the meeting in #884: we've identified that one day we may have to support more than just 'canonical' and 'AMP'.
To prevent lock-in to binary platform delivery, we should phase out our use of the
isAmp
boolean and instead refer to aplatform
string which may have the value 'canonical', 'AMP' or something else in the future.Notes from Jim:
Describe the solution you'd like
Create the PlatformContext, and use PlatformContex.Provider in the Article container & PlatformContainer.Consumer in the Image container. A POC can be seen here: #878.
Rather than passing
isAmp
as props, passplatform
via the context. Almost everywhere in our code where we refer toisAmp
, we should make a change.That said, in containers which need AMP logic, there's nothing stopping us from doing
isAmp = platform === 'amp'
and then referring toisAmp
in the rest of the file.Describe alternatives you've considered
The alternative is passing the platform as a prop down nested components - quickly gets messy.
Another alternative is some centralised state (eg Redux), but this isn't necessary at this time.
The alternative is to keep things the way they are - but could become a maintenance nightmare if that 3rd platform becomes a requirement in the future! Making the change to
platform
means we'd have to make changes to a minimal number of files.Testing notes
Unit tests should be sufficient.
The text was updated successfully, but these errors were encountered: