mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 22:19:48 +03:00
Fix stringifying
This commit is contained in:
parent
438d08dd7c
commit
02cb2bbaba
|
@ -176,12 +176,14 @@ const defaultOptions: Options = {
|
|||
export interface Node {
|
||||
name: string;
|
||||
children?: this[] | null;
|
||||
object?: unknown;
|
||||
value?: unknown;
|
||||
}
|
||||
|
||||
export interface InternalNode {
|
||||
name: string;
|
||||
children?: this[] | null;
|
||||
object?: unknown;
|
||||
value?: unknown;
|
||||
id: string | number;
|
||||
}
|
||||
|
|
|
@ -83,11 +83,11 @@ export function getNodeGroupByDepthCount(rootNode: InternalNode) {
|
|||
}
|
||||
|
||||
export function getTooltipString(
|
||||
node: unknown,
|
||||
node: HierarchyPointNodeWithPrivateChildren<InternalNode>,
|
||||
i: number | undefined,
|
||||
{ indentationSize = 4 }
|
||||
) {
|
||||
if (!is(Object, node)) return '';
|
||||
if (!is(Object, node.data)) return '';
|
||||
|
||||
const spacer = join(' ');
|
||||
const cr2br = replace(/\n/g, '<br/>');
|
||||
|
@ -96,9 +96,9 @@ export function getTooltipString(
|
|||
|
||||
const children = node.children || node._children;
|
||||
|
||||
if (typeof node.value !== 'undefined') return json2html(node.value);
|
||||
if (typeof node.object !== 'undefined') return json2html(node.object);
|
||||
if (children && children.length)
|
||||
return `childrenCount: ${(children as unknown[]).length}`;
|
||||
if (typeof node.data.value !== 'undefined') return json2html(node.data.value);
|
||||
if (typeof node.data.object !== 'undefined')
|
||||
return json2html(node.data.object);
|
||||
if (children && children.length) return `childrenCount: ${children.length}`;
|
||||
return 'empty';
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import mapValues from 'lodash/mapValues';
|
|||
export interface Node {
|
||||
name: string;
|
||||
children?: Node[] | null;
|
||||
object?: unknown;
|
||||
value?: unknown;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user