forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enableSuspenseServerRenderer feature flag (facebook#13573)
- Loading branch information
1 parent
9d35bfd
commit 1b9fa05
Showing
11 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
packages/react-dom/src/__tests__/ReactDOMServerPlaceholders-test.internal.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,59 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils'); | ||
|
||
let React; | ||
let ReactDOM; | ||
let ReactDOMServer; | ||
let ReactFeatureFlags; | ||
|
||
function initModules() { | ||
// Reset warning cache. | ||
jest.resetModuleRegistry(); | ||
|
||
ReactFeatureFlags = require('shared/ReactFeatureFlags'); | ||
ReactFeatureFlags.enableSuspense = true; | ||
ReactFeatureFlags.enableSuspenseServerRenderer = true; | ||
|
||
React = require('react'); | ||
ReactDOM = require('react-dom'); | ||
ReactDOMServer = require('react-dom/server'); | ||
|
||
// Make them available to the helpers. | ||
return { | ||
ReactDOM, | ||
ReactDOMServer, | ||
}; | ||
} | ||
|
||
const {resetModules, serverRender} = ReactDOMServerIntegrationUtils( | ||
initModules, | ||
); | ||
|
||
describe('ReactDOMServerPlaceholders', () => { | ||
beforeEach(() => { | ||
resetModules(); | ||
}); | ||
|
||
it('should always render the fallback when a placeholder is encountered', async () => { | ||
const Suspended = props => { | ||
throw new Promise(() => {}); | ||
}; | ||
const e = await serverRender( | ||
<React.Placeholder fallback={<div />}> | ||
<Suspended /> | ||
</React.Placeholder>, | ||
); | ||
|
||
expect(e.tagName).toBe('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
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
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
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