-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(server): remove act around server renderer to fix support for old…
…er versions of react * refactor(server/pure): remove unnecessary type annotation * feat: add ssr.test.ts This adds a new test to verify that renderHook can be called in an SSR-like environment based on the changes implemented in #607. * chore: update contributors table * refactor: remove act call in render in sever/pure @mpeyper explained how this `act` call in server rendering is not really necessary so we can remove it.
- Loading branch information
Showing
4 changed files
with
27 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
import { useState } from 'react' | ||
|
||
// This verifies that renderHook can be called in | ||
// a SSR-like environment. | ||
describe('renderHook', () => { | ||
function useLoading() { | ||
const [loading, setLoading] = useState(false) | ||
return { loading, setLoading } | ||
} | ||
runForRenderers(['server'], ({ renderHook }) => { | ||
test('should not throw in SSR environment', () => { | ||
expect(() => renderHook(() => useLoading())).not.toThrowError('document is not defined') | ||
}) | ||
}) | ||
}) |
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