Closed jimthedev closed 4 years ago
Confirmed the issue. Thanks.
I think it's because we pass {}
to Proxy.
https://github.com/dai-shi/react-suspense-fetch/blob/6ec6369949896b31f9fec60ef71edc0ff6b5db75/src/index.ts#L136
I expected that Object.key is also trapped by ownKeys
but maybe not.
Hm, not sure how to deal with it.
If this {}
is the cause, this issue won't affect reactive-react-redux nor react-tracked, because they have the original object.
> p = new Proxy({ a: 1 }, { ownKeys() { console.log('ownKeys'); return ['b']; } });
Proxy {a: 1}
> Object.keys(p)
ownKeys
[]
> Object.getOwnPropertyNames(p)
ownKeys
["b"]
OK, it's trapped, but returning []
. How come.
Hm, now wondering why it works in reactive-react-redux.
OK, Object.keys only lists enumerable
s.
So, we need to trap getOwnPropertyDescriptor too.
https://codesandbox.io/s/hungry-merkle-fnri1 It's fixed.
Thanks for reporting!
Thanks it is working great!
Hey there.
Lines 34: https://codesandbox.io/s/optimistic-nightingale-m617m
You can see object.keys shows as an empty array. Any ideas?