Skip to content

Commit

Permalink
Merge branch 'development' into add-locale-support
Browse files Browse the repository at this point in the history
  • Loading branch information
JayaKrishnaNamburu committed Oct 17, 2024
2 parents 7491998 + 4388577 commit 6420553
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/teleport-plugin-next-static-props/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export const generateInitialPropsAST = (
types.catchClause(
types.identifier('error'),
types.blockStatement([
types.expressionStatement(
types.callExpression(
types.memberExpression(types.identifier('console'), types.identifier('log')),
[types.identifier('error')]
)
),
types.returnStatement(
types.objectExpression([
types.objectProperty(types.identifier('notFound'), types.booleanLiteral(true)),
Expand Down Expand Up @@ -97,6 +103,23 @@ const computePropsAST = (
true
)
),
types.spreadElement(
types.logicalExpression(
'&&',
types.optionalMemberExpression(
types.identifier('context'),
types.identifier('locale'),
false,
true
),
types.objectExpression([
types.objectProperty(
types.identifier('locale'),
types.memberExpression(types.identifier('context'), types.identifier('locale'))
),
])
)
),
...funcParams,
]),
])
Expand Down

0 comments on commit 6420553

Please sign in to comment.