MCPcopy
hub / github.com/facebook/react / dehydrateKey

Function dehydrateKey

packages/react-devtools-shared/src/hydration.js:611–649  ·  view source on GitHub ↗
(
  parent: Object,
  key: number | string | symbol,
  cleaned: Array<Array<string | number>>,
  unserializable: Array<Array<string | number>>,
  path: Array<string | number>,
  isPathAllowed: (path: Array<string | number>) => boolean,
  level: number = 0,
)

Source from the content-addressed store, hash-verified

609}
610
611function dehydrateKey(
612 parent: Object,
613 key: number | string | symbol,
614 cleaned: Array<Array<string | number>>,
615 unserializable: Array<Array<string | number>>,
616 path: Array<string | number>,
617 isPathAllowed: (path: Array<string | number>) => boolean,
618 level: number = 0,
619): DehydratedData['data'] {
620 try {
621 return dehydrate(
622 parent[key],
623 cleaned,
624 unserializable,
625 path,
626 isPathAllowed,
627 level,
628 );
629 } catch (error) {
630 let preview = '';
631 if (
632 typeof error === 'object' &&
633 error !== null &&
634 typeof error.stack === 'string'
635 ) {
636 preview = error.stack;
637 } else if (typeof error === 'string') {
638 preview = error;
639 }
640 cleaned.push(path);
641 return {
642 inspectable: false,
643 preview_short: '[Exception]',
644 preview_long: preview ? '[Exception: ' + preview + ']' : '[Exception]',
645 name: preview,
646 type: 'unknown',
647 };
648 }
649}
650
651export function fillInPath(
652 object: Object,

Callers 1

dehydrateFunction · 0.85

Calls 2

dehydrateFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected