-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues if array has Getter #478
Comments
Thanks for reporting the problem. We're not quite sure exactly what's going on yet, but we can duplicate the issue outside of Quokka using: let size = 2;
const real = [1,2,3,4];
const pseudo = Array(size);
for (let i = 0; i < size; i++) {
Object.defineProperty(pseudo, i, {
get(){
return real[i]
},
set(value){
return real[i] = value;
}
});
}
pseudo.splice(0, pseudo.length); Node.js returns:
Interestingly, if we set the array before it's defined, the code runs successfully: let size = 2;
const real = [1,2,3,4];
const pseudo = Array(size);
+ pseudo[0] = undefined;
+ pseudo[1] = undefined;
for (let i = 0; i < size; i++) {
Object.defineProperty(pseudo, i, {
get(){
return real[i]
},
set(value){
return real[i] = value;
}
});
}
pseudo.splice(0, pseudo.length); We're going to investigate further as to why this is occurring but it may be that defining the property on the array as you are doing is not supported by node (at least not without breaking some functions of the Array). |
Then I will say Thank You Too twice! |
We've found that this is caused by As a short term workaround, you may set configurable to We're continuing to investigate a proper fix for this that will allow you to use configurable |
Thank you! Yes I just found that while smoking and came to response about configurable default to false in defineProperty but you was faster :) , Will try it now. Thanks for so detailed explanation! |
This has been fixed and is available in the latest version of Wallaby core, v1.0.893. |
Issue description or question
If Array contains Getters/Setters, when you try to expand it inside Value Explorer:
1 - Error in Value Explorer: Cannot delete property '1'...
2 - in 'pseudo' array new value will be added for no reason
3 - getting value will be undefined
Sample code
Results are same on VSCode and Webstorm.
OS name and version
Windows 10
The text was updated successfully, but these errors were encountered: