Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwootto committed Oct 24, 2023
1 parent 06eaa22 commit ca37cd0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/nextjs/app-router/app/clientside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -155,4 +155,4 @@ const Home = ({ children }: { children: ReactNode }) => {
)
}

export default Home
export default ClientSide
17 changes: 12 additions & 5 deletions examples/nextjs/app-router/app/page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<b>Server Variable</b>
Expand All @@ -18,13 +24,14 @@ async function ServerData() {
)
}

const Page: NextPage = ({ children }: { children: ReactNode }) => {
const Page: NextPage = async ({ children }: { children: ReactNode }) => {
console.log('RENDERING')

return (
<Home>
<ClientSide>
<ServerData />
</Home>
{children}
</ClientSide>
)
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion sdk/nextjs/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ export * from './server/getVariableValue'
export * from './server/requestContext'
export * from './server/devcycleServerData'
export * from './server/DevCycleClientProvider'
export * from './server/middleware'
1 change: 1 addition & 0 deletions sdk/nextjs/src/server/requestContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca37cd0

Please sign in to comment.