forked from opentripplanner/otp-ui
-
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 custom suspense with test mode fallback
co-author: miles-grant-ibigroup
- Loading branch information
1 parent
ceacd3e
commit f711776
Showing
40 changed files
with
21,268 additions
and
20,491 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
1,838 changes: 919 additions & 919 deletions
1,838
packages/base-map/src/__snapshots__/index.story.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
packages/core-utils/src/__snapshots__/core-utils.story.tsx.snap
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,19 @@ | ||
import React, { ReactElement, ReactNode, Suspense } from "react"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
fallback: ReactNode; | ||
}; | ||
|
||
const SafeSuspense = ({ children, fallback }: Props): ReactElement => { | ||
const IS_TEST_RUNNER = window.navigator.userAgent.match( | ||
/StorybookTestRunner/ | ||
); | ||
return IS_TEST_RUNNER ? ( | ||
<>{fallback}</> | ||
) : ( | ||
<Suspense fallback={fallback}>{children}</Suspense> | ||
); | ||
}; | ||
|
||
export default SafeSuspense; |
Oops, something went wrong.