Skip to content

Commit

Permalink
Flow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 20, 2019
1 parent fe943c3 commit 66c9fed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function InspectedElementContextController({children}: Props) {
const value = hydrateHelper(data.value, data.path);
const inspectedElement = {...currentlyInspectedElement};

fillInPath(inspectedElement, data.path, value);
fillInPath(inspectedElement, data.value, data.path, value);

resource.write(element, inspectedElement);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// @flow

import type {Dehydrated} from 'react-devtools-shared/src/hydration';
import type {
Dehydrated,
Unserializable,
} from 'react-devtools-shared/src/hydration';
import type {ElementType} from 'react-devtools-shared/src/types';

// Each element on the frontend corresponds to a Fiber on the backend.
Expand Down Expand Up @@ -87,7 +90,9 @@ export type DehydratedData = {|
data:
| string
| Dehydrated
| Unserializable
| Array<Dehydrated>
| {[key: string]: string | Dehydrated},
| Array<Unserializable>
| {[key: string]: string | Dehydrated | Unserializable},
unserializable: Array<Array<string | number>>,
|};
6 changes: 4 additions & 2 deletions packages/react-devtools-shared/src/hydration.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type Dehydrated = {|
// These objects can't be serialized without losing type information,
// so a "Unserializable" type wrapper is used (with meta-data keys) to send nested values-
// while preserving the original type and name.
type Unserializable = {
export type Unserializable = {
name: string | null,
readonly?: boolean,
size?: number,
Expand Down Expand Up @@ -196,6 +196,8 @@ export function dehydrate(
| string
| Dehydrated
| Unserializable
| Array<Dehydrated>
| Array<Unserializable>
| {[key: string]: string | Dehydrated | Unserializable} {
const type = getDataType(data);

Expand Down Expand Up @@ -380,7 +382,7 @@ export function fillInPath(
}

export function hydrate(
object: Object,
object: any,
cleaned: Array<Array<string | number>>,
unserializable: Array<Array<string | number>>,
): Object {
Expand Down

0 comments on commit 66c9fed

Please sign in to comment.