Skip to content

Commit

Permalink
Another fix, this time for proxies accidentally getting assigned to true
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Mar 19, 2018
1 parent 2dd9ed1 commit 5a6c835
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,20 @@ function setUpObject<S>(
obj[parentSymbol](emit, parent, path);
return obj;
} else {
obj[apc] =
(obj[apc] &&
// @ts-ignore
obj[apc][symbol]) ||
cProxy(obj, emit, symbol, false, path, parent);
obj[vpc] =
(obj[vpc] &&
// @ts-ignore
obj[vpc][symbol]) ||
cProxy(obj, emit, symbol, true, path, parent);
// have to ignore errors because typescript doesn't like indexing with symbols
if (
!obj[apc] ||
// @ts-ignore
!obj[apc][symbol]
)
obj[apc] = cProxy(obj, emit, symbol, false, path, parent);

if (
!obj[vpc] ||
// @ts-ignore
!obj[vpc][symbol]
)
obj[vpc] = cProxy(obj, emit, symbol, true, path, parent);
}

for (let prop in obj) {
Expand All @@ -178,7 +182,7 @@ function setUpObject<S>(
}

function cProxy<S>(
obj: object,
obj: Model<S>,
emit: EmitFn,
symbol: Symbol,
view: boolean,
Expand Down

0 comments on commit 5a6c835

Please sign in to comment.