diff --git a/examples/nextjs/app-router/app/clientside.tsx b/examples/nextjs/app-router/app/clientside.tsx index 8d645e89f..574f8d465 100644 --- a/examples/nextjs/app-router/app/clientside.tsx +++ b/examples/nextjs/app-router/app/clientside.tsx @@ -7,7 +7,7 @@ import { useVariableValue } from '@devcycle/next-sdk' import { UserIdentity } from './UserIdentity' import { ReactNode } from 'react' -const Home = ({ children }: { children: ReactNode }) => { +const ClientSide = ({ children }: { children: ReactNode }) => { console.log('RENDERING') const variableKey = 'test-featre' @@ -155,4 +155,4 @@ const Home = ({ children }: { children: ReactNode }) => { ) } -export default Home +export default ClientSide diff --git a/examples/nextjs/app-router/app/page.tsx b/examples/nextjs/app-router/app/page.tsx index 7167cb110..74ba92f1c 100644 --- a/examples/nextjs/app-router/app/page.tsx +++ b/examples/nextjs/app-router/app/page.tsx @@ -1,10 +1,16 @@ import type { NextPage } from 'next' import { ReactNode } from 'react' -import Home from './clientside' -import { getUserIdentity, getVariableValue } from '@devcycle/next-sdk/server' +import ClientSide from './clientside' +import { + getUserIdentity, + getVariableValue, + identifyUser, +} from '@devcycle/next-sdk/server' import * as React from 'react' async function ServerData() { + await identifyUser({ user_id: 'server-override' }) + return ( <> Server Variable @@ -18,13 +24,14 @@ async function ServerData() { ) } -const Page: NextPage = ({ children }: { children: ReactNode }) => { +const Page: NextPage = async ({ children }: { children: ReactNode }) => { console.log('RENDERING') return ( - + - + {children} + ) } diff --git a/package.json b/package.json index 5894cbbc4..945680ae2 100644 --- a/package.json +++ b/package.json @@ -125,6 +125,7 @@ "cross-env": "^7.0.3", "css-loader": "^6.4.0", "cypress": "^12.11.0", + "debug": "^4.3.4", "detox": "20.9.1", "dotenv-webpack": "^7.0.3", "esbuild": "^0.17.17", diff --git a/sdk/nextjs/src/server.ts b/sdk/nextjs/src/server.ts index fd300fb78..716935910 100644 --- a/sdk/nextjs/src/server.ts +++ b/sdk/nextjs/src/server.ts @@ -4,4 +4,3 @@ export * from './server/getVariableValue' export * from './server/requestContext' export * from './server/devcycleServerData' export * from './server/DevCycleClientProvider' -export * from './server/middleware' diff --git a/sdk/nextjs/src/server/requestContext.ts b/sdk/nextjs/src/server/requestContext.ts index 0d227203f..bcd059770 100644 --- a/sdk/nextjs/src/server/requestContext.ts +++ b/sdk/nextjs/src/server/requestContext.ts @@ -34,6 +34,7 @@ export const getSDKKey = () => { } export const setSDKKey = (key: string) => { + console.log('SETTING SDK KEY') // attempt to make sure server keys don't leak to the client! if ( key?.length && diff --git a/yarn.lock b/yarn.lock index 8aaae83d5..cad3d80a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15153,6 +15153,7 @@ __metadata: cross-fetch: ^3.1.5 css-loader: ^6.4.0 cypress: ^12.11.0 + debug: ^4.3.4 detox: 20.9.1 dotenv-webpack: ^7.0.3 esbuild: ^0.17.17