From 15d8c72c9b4590a4e2c585365fa1ff73ca73340d Mon Sep 17 00:00:00 2001 From: FaberVitale Date: Mon, 28 Jun 2021 11:06:08 +0200 Subject: [PATCH] refactor(rtk-query): move preview to containers remove unnecessary computation --- .../QueryPreview.tsx | 25 +++++++++++++------ .../src/containers/RtkQueryInspector.tsx | 5 +--- 2 files changed, 18 insertions(+), 12 deletions(-) rename packages/redux-devtools-rtk-query-monitor/src/{components => containers}/QueryPreview.tsx (90%) diff --git a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreview.tsx b/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx similarity index 90% rename from packages/redux-devtools-rtk-query-monitor/src/components/QueryPreview.tsx rename to packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx index d0cf19c5..2a854ad1 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/components/QueryPreview.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/containers/QueryPreview.tsx @@ -7,22 +7,31 @@ import { SelectorsSource, TabOption, } from '../types'; -import { QueryPreviewHeader } from './QueryPreviewHeader'; -import { QueryPreviewInfo, QueryPreviewInfoProps } from './QueryPreviewInfo'; -import { QueryPreviewApi, QueryPreviewApiProps } from './QueryPreviewApi'; +import { QueryPreviewHeader } from '../components/QueryPreviewHeader'; +import { + QueryPreviewInfo, + QueryPreviewInfoProps, +} from '../components/QueryPreviewInfo'; +import { + QueryPreviewApi, + QueryPreviewApiProps, +} from '../components/QueryPreviewApi'; import { QueryPreviewSubscriptions, QueryPreviewSubscriptionsProps, -} from './QueryPreviewSubscriptions'; -import { QueryPreviewTags, QueryPreviewTagsProps } from './QueryPreviewTags'; -import { NoRtkQueryApi } from './NoRtkQueryApi'; +} from '../components/QueryPreviewSubscriptions'; +import { + QueryPreviewTags, + QueryPreviewTagsProps, +} from '../components/QueryPreviewTags'; +import { NoRtkQueryApi } from '../components/NoRtkQueryApi'; import { InspectorSelectors } from '../selectors'; import { StylingFunction } from 'react-base16-styling'; -import { mapProps } from '../containers/mapProps'; +import { mapProps } from './mapProps'; import { QueryPreviewActions, QueryPreviewActionsProps, -} from './QueryPreviewActions'; +} from '../components/QueryPreviewActions'; export interface QueryPreviewProps { readonly selectedTab: QueryPreviewTabs; diff --git a/packages/redux-devtools-rtk-query-monitor/src/containers/RtkQueryInspector.tsx b/packages/redux-devtools-rtk-query-monitor/src/containers/RtkQueryInspector.tsx index cd7b0e3e..10bef8ab 100644 --- a/packages/redux-devtools-rtk-query-monitor/src/containers/RtkQueryInspector.tsx +++ b/packages/redux-devtools-rtk-query-monitor/src/containers/RtkQueryInspector.tsx @@ -17,7 +17,7 @@ import { } from '../reducers'; import { QueryList } from '../components/QueryList'; import { QueryForm } from '../components/QueryForm'; -import { QueryPreview } from '../components/QueryPreview'; +import { QueryPreview } from './QueryPreview'; type ForwardedMonitorProps> = Pick< LiftedState, @@ -124,9 +124,6 @@ class RtkQueryInspector> extends PureComponent< const hasNoApi = apiStates == null; - const actionsOfCurrentQuery = - this.selectors.selectActionsOfCurrentQuery(selectorsSource); - return (