mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 06:00:07 +03:00
Fix rtk-query-monitor types
This commit is contained in:
parent
1ad63b5ce5
commit
9817a664e9
|
@ -1,6 +1,7 @@
|
|||
import { createSelector, Selector } from '@reduxjs/toolkit';
|
||||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import { Action, AnyAction } from 'redux';
|
||||
import type { KeyPath, ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { emptyRecord, identity } from '../utils/object';
|
||||
|
@ -43,7 +44,7 @@ export class QueryPreviewActions extends PureComponent<QueryPreviewActionsProps>
|
|||
return output;
|
||||
});
|
||||
|
||||
isLastActionNode = (keyPath: (string | number)[], layer: number): boolean => {
|
||||
isLastActionNode = (keyPath: KeyPath, layer: number): boolean => {
|
||||
if (layer >= 1) {
|
||||
const len = this.props.actionsOfQuery.length;
|
||||
const actionKey = keyPath[keyPath.length - 1];
|
||||
|
@ -58,11 +59,11 @@ export class QueryPreviewActions extends PureComponent<QueryPreviewActionsProps>
|
|||
return false;
|
||||
};
|
||||
|
||||
shouldExpandNodeInitially = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
if (layer === 1) {
|
||||
return this.isLastActionNode(keyPath, layer);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { ApiStats, QueryPreviewTabs, RtkQueryApiState } from '../types';
|
||||
import { StyleUtilsContext } from '../styles/createStylingFromTheme';
|
||||
import { TreeView, TreeViewProps } from './TreeView';
|
||||
|
@ -17,11 +18,11 @@ const rootProps: TreeViewProps['rootProps'] = {
|
|||
};
|
||||
|
||||
export class QueryPreviewApi extends PureComponent<QueryPreviewApiProps> {
|
||||
shouldExpandApiStateNode = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandApiStateNode: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
const lastKey = keyPath[keyPath.length - 1];
|
||||
|
||||
return layer <= 1 && lastKey !== 'config';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs, RtkResourceInfo } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { TreeView, TreeViewProps } from './TreeView';
|
||||
|
@ -15,11 +16,11 @@ const rootProps: TreeViewProps['rootProps'] = {
|
|||
};
|
||||
|
||||
export class QueryPreviewData extends PureComponent<QueryPreviewDataProps> {
|
||||
shouldExpandNodeInitially = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
return layer <= 1;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { createSelector, Selector } from '@reduxjs/toolkit';
|
||||
import { QueryStatus } from '@reduxjs/toolkit/dist/query';
|
||||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs, RtkResourceInfo, RTKStatusFlags } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { formatMs } from '../utils/formatters';
|
||||
|
@ -35,11 +36,11 @@ export interface QueryPreviewInfoProps {
|
|||
isWideLayout: boolean;
|
||||
}
|
||||
export class QueryPreviewInfo extends PureComponent<QueryPreviewInfoProps> {
|
||||
shouldExpandNodeInitially = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
const lastKey = keyPath[keyPath.length - 1];
|
||||
|
||||
return layer <= 1 && lastKey !== 'query' && lastKey !== 'mutation';
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { ReactNode } from 'react';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
import type { LabelRenderer } from 'react-json-tree';
|
||||
import { isCollection, isIndexed, isKeyed } from 'immutable';
|
||||
import isIterable from '../utils/isIterable';
|
||||
|
||||
|
@ -91,12 +92,10 @@ export function getItemString(
|
|||
);
|
||||
}
|
||||
|
||||
export function createTreeItemLabelRenderer(styling: StylingFunction) {
|
||||
return function labelRenderer(
|
||||
[key]: (string | number)[],
|
||||
nodeType: string,
|
||||
expanded: boolean
|
||||
): ReactNode {
|
||||
export function createTreeItemLabelRenderer(
|
||||
styling: StylingFunction
|
||||
): LabelRenderer {
|
||||
return function labelRenderer([key], nodeType, expanded) {
|
||||
return (
|
||||
<span>
|
||||
<span {...styling('treeItemKey')}>{key}</span>
|
||||
|
|
Loading…
Reference in New Issue
Block a user