Skip to content

Commit

Permalink
Update react-helmet-async to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-ac-martin committed Aug 28, 2024
1 parent 5086f7c commit 78803d7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/govuk-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"plop": "3.1.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-helmet-async": "1.3.0",
"react-helmet-async": "2.0.5",
"react-router": "5.3.4",
"react-router-dom": "5.3.4",
"serverless": "3.39.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/govuk-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"plop": "3.1.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-helmet-async": "1.3.0",
"react-helmet-async": "2.0.5",
"react-router": "5.3.4",
"react-router-dom": "5.3.4",
"serverless": "3.39.0",
Expand Down
10 changes: 7 additions & 3 deletions lib/app-composer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLSchema } from 'graphql';
import { ApolloClient, ApolloProvider, InMemoryCache, createHttpLink } from '@apollo/client';
import { SchemaLink } from '@apollo/client/link/schema';
import { ComponentType, Fragment, ReactNode, Suspense, createElement as h, lazy } from 'react';
import { Helmet, HelmetProvider, FilledContext } from 'react-helmet-async';
import { Helmet, HelmetProvider, HelmetServerState } from 'react-helmet-async';
import { StaticRouter, StaticRouterProps, Switch } from 'react-router';
import { BrowserRouter, BrowserRouterProps } from 'react-router-dom';
import { Route, RouteComponentProps, withRouter } from '@not-govuk/route-utils';
Expand Down Expand Up @@ -54,6 +54,10 @@ type ServerError = {
message: string
};

export type HelmetDataContext = {
helmet: HelmetServerState
}

export type ApplicationPropsSSR = ApplicationPropsCommon & {
pages: PageInfoSSR[]
};
Expand All @@ -63,7 +67,7 @@ export type ApplicationProps = ApplicationPropsCSR | ApplicationPropsSSR;
type ApplicationCSR = ComponentType<ApplicationPropsCSR>;
type ApplicationSSR = ComponentType<ApplicationPropsSSR> & {
extractDataCache: () => object
helmetContext: FilledContext
helmetContext: HelmetDataContext
};
export type Application = ComponentType<ApplicationProps>;

Expand Down Expand Up @@ -304,7 +308,7 @@ export const compose: Compose = options => {

return Object.assign(App, {
extractDataCache,
helmetContext: helmetContext as FilledContext
helmetContext: helmetContext as HelmetDataContext
});
};

Expand Down
2 changes: 1 addition & 1 deletion lib/server-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@types/react": "16.14.60",
"@types/react-dom": "16.9.24",
"graphql": "15.9.0",
"react-helmet-async": "1.3.0",
"react-helmet-async": "2.0.5",
"typescript": "4.9.5"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"process": "^0.11.10",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-helmet-async": "1.3.0",
"react-helmet-async": "2.0.5",
"react-router": "5.3.4",
"react-router-dom": "5.3.4",
"ts-jest": "29.2.3",
Expand Down

1 comment on commit 78803d7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.