-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/production/optimize-server-react/optimize-server-react.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
;(process.env.TURBOPACK ? describe.skip : describe)( | ||
'optimize-server-react', | ||
() => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should work with useEffect', async () => { | ||
const browser = await next.browser('/') | ||
expect(await browser.elementByCss('p').text()).toBe('hello world') | ||
}) | ||
|
||
it('should optimize useEffect call on server side', async () => { | ||
const file = await next.readFile('.next/server/pages/index.js') | ||
expect(file).not.toContain('useEffect') | ||
}) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { useEffect } from 'react' | ||
|
||
export default function Page() { | ||
useEffect(() => { | ||
console.log('use-effect-call-log') | ||
}, []) | ||
return <p>hello world</p> | ||
} | ||
|
||
// Mark as dynamic | ||
export function getServerSideProps() { | ||
return { props: {} } | ||
} |