-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing dev option for the middleware SSR loader (#30639)
Currently the `dev` option isn't passed to the render function inside the middleware SSR loader. This PR fixes it with a test case. Fixes #30547. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
- Loading branch information
Showing
10 changed files
with
100 additions
and
2 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
5 changes: 5 additions & 0 deletions
5
test/integration/react-rsc-basic/app/components/red/index.client.js
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,5 @@ | ||
import styles from './style.module.css' | ||
|
||
export default function RedText({ children }) { | ||
return <div className={styles.text}>{children}</div> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/react-rsc-basic/app/components/red/style.module.css
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,3 @@ | ||
.text { | ||
color: red; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import '../styles.css' | ||
|
||
function App({ Component, pageProps }) { | ||
return <Component {...pageProps} /> | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
test/integration/react-rsc-basic/app/pages/css-modules.server.js
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,10 @@ | ||
// CSS modules can only be imported inside client components for now. | ||
import RedText from '../components/red/index.client' | ||
|
||
export default function CSSM() { | ||
return ( | ||
<RedText> | ||
<h1>This should be in red</h1> | ||
</RedText> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
test/integration/react-rsc-basic/app/pages/global-styles-rsc.server.js
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,7 @@ | ||
export default function GlobalStyle() { | ||
return ( | ||
<div> | ||
<h1 id="red">This should be in red</h1> | ||
</div> | ||
) | ||
} |
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,7 @@ | ||
export default function GlobalStyle() { | ||
return ( | ||
<div> | ||
<h1 id="red">This should be in red</h1> | ||
</div> | ||
) | ||
} |
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,3 @@ | ||
#red { | ||
color: red; | ||
} |
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,27 @@ | ||
/* eslint-env jest */ | ||
import webdriver from 'next-webdriver' | ||
|
||
export default function (context) { | ||
it('should include global styles under `concurrentFeatures: true`', async () => { | ||
const browser = await webdriver(context.appPort, '/global-styles') | ||
const currentColor = await browser.eval( | ||
`window.getComputedStyle(document.querySelector('#red')).color` | ||
) | ||
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) | ||
}) | ||
it('should include global styles with `serverComponents: true`', async () => { | ||
const browser = await webdriver(context.appPort, '/global-styles-rsc') | ||
const currentColor = await browser.eval( | ||
`window.getComputedStyle(document.querySelector('#red')).color` | ||
) | ||
expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) | ||
}) | ||
// TODO: fix this test | ||
// it.skip('should include css modules with `serverComponents: true`', async () => { | ||
// const browser = await webdriver(context.appPort, '/css-modules') | ||
// const currentColor = await browser.eval( | ||
// `window.getComputedStyle(document.querySelector('h1')).color` | ||
// ) | ||
// expect(currentColor).toMatchInlineSnapshot(`"rgb(255, 0, 0)"`) | ||
// }) | ||
} |
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