deprecatedAsyncView.tsx 863 B

123456789101112131415161718192021222324252627
  1. import DeprecatedAsyncComponent from 'sentry/components/deprecatedAsyncComponent';
  2. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  3. export type AsyncViewState = DeprecatedAsyncComponent['state'];
  4. export type AsyncViewProps = DeprecatedAsyncComponent['props'];
  5. /**
  6. * @deprecated use useApiQuery instead.
  7. *
  8. * Read the dev docs page on network requests for more information [1].
  9. *
  10. * [1]: https://develop.sentry.dev/frontend/network-requests/
  11. */
  12. export default abstract class DeprecatedAsyncView<
  13. P extends AsyncViewProps = AsyncViewProps,
  14. S extends AsyncViewState = AsyncViewState,
  15. > extends DeprecatedAsyncComponent<P, S> {
  16. abstract getTitle(): string;
  17. render() {
  18. return (
  19. <SentryDocumentTitle title={this.getTitle()}>
  20. {this.renderComponent() as React.ReactChild}
  21. </SentryDocumentTitle>
  22. );
  23. }
  24. }