Skip to content

Upgrading from 0.2.x to 0.3.x

Matt Hinchliffe edited this page Nov 22, 2019 · 1 revision

This guide is suitable for most FT.com apps which have followed the n-ui to Page Kit migration guide.

App context changes

To disambiguate the use of context as a generic variable name we have renamed some options which explicitly expect to receive an app context object. This change has been made to the app context middleware, app context UI component, and shell component.

  1. If the app initialises the app context middleware with options then the context option must be updated:

    app.use(
        pageKitAppContext.init({
    -       context: { product: 'not-next' }
    +       appContext: { product: 'not-next' }
        })
    )
  2. The shell component context prop must be renamed appContext:

    const element = React.createElement(
        Shell,
    -    { ...shellProps, flags, context },
    +    { ...shellProps, flags, appContext },
        React.createElement(Layout, { ...layoutProps, contents: html })
    );
    
    response.send('<!DOCTYPE html>' + ReactDOM.renderToStaticMarkup(element));

Please note that both the n-tracking and n-ads components also expect to receive an appContext option, on the client and server-side.