Make DevTools resilient to TypeError: 'getOwnPropertyDescriptor' on proxy
DefectingCat opened this issue · 8 comments
Total error message:
TypeError: 'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'path' that is incompatible with the existing property in the proxy target
Here is my state (i delete some useless property for short):
{
proj: {
name: '新工程',
data: {
config: {},
scene: {
id: 'Mjbw6qfDaC6IpFTrOqGmS',
bg: {
type: 'pano',
path: '/static/media/leftLogin.3932ccac.png',
id: 0,
static_bg: {
path: '',
size: 'cover'
},
},
logo: '',
spots: [],
nodes: [],
children: []
}
}
}
}
I want to push "new scene" property into the scene.children
in data:
let sceneList: SceneInfo[] = [someScene];
parentScene.children.merge(sceneList);
The new scene is same with the scene
in data
. but its include a node
property. It's a array, and its (element in array) has a model
property.
The error message above is about the model
property. if i delete the model
property, it will be works
Here is call stack:
(Please forgive me about the English syntax)
Hi, very interesting. Looks like a bug in hookstate. Would you be able to create a reproducer which i could run a debug?
…
On Thu, 26 May 2022, 14:14 Defectink, @.> wrote: Total error message: TypeError: 'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'path' that is incompatible with the existing property in the proxy target Here is my state (i delete some useless property for short): { proj: { name: '新工程', data: { config: {}, scene: { id: 'Mjbw6qfDaC6IpFTrOqGmS', bg: { type: 'pano', path: '/static/media/leftLogin.3932ccac.png', id: 0, static_bg: { path: '', size: 'cover' }, }, logo: '', spots: [], nodes: [], children: [] } } } } I want to push "new scene" property into the scene.children in data: let sceneList: SceneInfo[] = [someScene]; parentScene.children.merge(sceneList); The new scene is same with the scene in data. but its include a node property. It's a array, and its (element in array) has a model property. The error message above is about the model property. if i delete the model property, it will be works [image: image] https://user-images.githubusercontent.com/25033493/170400083-e7040180-70ed-4830-91fe-f0bb7aff946c.png Here is call stack: [image: image] https://user-images.githubusercontent.com/25033493/170401213-61d4e477-66e0-48a7-b94b-0a2b4d88c534.png (Please forgive me about the English syntax) — Reply to this email directly, view it on GitHub <#286>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6JSVIOGOELRDAGFGOLCQTVL3NA3ANCNFSM5W7KXY7Q . You are receiving this because you are subscribed to this thread.Message ID: @.>
Of couse, but i need a little time to create it
Similar error:
react_devtools_backend.js:626
Uncaught TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'length' which is either non-existent or configurable in the proxy target
at Function.keys (<anonymous>)
at getAllEnumerableKeys (react_devtools_backend.js:626:36)
at formatDataForPreview (react_devtools_backend.js:1359:33)
at createDehydrated (react_devtools_backend.js:3450:94)
at dehydrate (react_devtools_backend.js:3635:16)
at react_devtools_backend.js:3640:26
at Set.forEach (<anonymous>)
at dehydrate (react_devtools_backend.js:3638:91)
at react_devtools_backend.js:3640:26
at Set.forEach (<anonymous>)
fixed in 4.0.0-rc11
Is there anywhere I can reference this fix?
I have a product in production right now that is recently encountering this on 3.x.
I don't mind working around it in the userspace for now but I need to understand the root cause and how you've fixed in 4.x in order to do so.
Hi,
the simplest fix would be to declare state object properties as not enumerable. I do not remember which one in particular was sensitive to cause the issue. The hookstate 4 had major changes on this front which are hard to port back now. Hookstate 3 will be declared unsupported very soon as soon as non RC version of hookstate 4 is released. Which I plan by the end of this year.
My repository is using version "@hookstate/core": "^4.0.1", and still when I try to .merge a state I get this error.
This only happens when I have redux devtools open.