1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import * as React from 'react';
    
  11. import {findGitHubIssue} from './cache';
    
  12. import UpdateExistingIssue from './UpdateExistingIssue';
    
  13. import ReportNewIssue from './ReportNewIssue';
    
  14. import WorkplaceGroup from './WorkplaceGroup';
    
  15. 
    
  16. type Props = {
    
  17.   callStack: string | null,
    
  18.   componentStack: string | null,
    
  19.   errorMessage: string | null,
    
  20. };
    
  21. 
    
  22. export default function SuspendingErrorView({
    
  23.   callStack,
    
  24.   componentStack,
    
  25.   errorMessage,
    
  26. }: Props): React.Node {
    
  27.   const maybeItem =
    
  28.     errorMessage !== null ? findGitHubIssue(errorMessage) : null;
    
  29. 
    
  30.   let GitHubUI;
    
  31.   if (maybeItem != null) {
    
  32.     GitHubUI = <UpdateExistingIssue gitHubIssue={maybeItem} />;
    
  33.   } else {
    
  34.     GitHubUI = (
    
  35.       <ReportNewIssue
    
  36.         callStack={callStack}
    
  37.         componentStack={componentStack}
    
  38.         errorMessage={errorMessage}
    
  39.       />
    
  40.     );
    
  41.   }
    
  42. 
    
  43.   return (
    
  44.     <>
    
  45.       {GitHubUI}
    
  46.       <WorkplaceGroup />
    
  47.     </>
    
  48.   );
    
  49. }