TypeError: 'set' on proxy: trap returned falsish for property
See original GitHub issueHello awesome polly! Got an error not sure if it is me but it only happens when I use strict;. I am not adding a new path just editing existing path. If it is a bug lets see if we can fix it. If it is me slap me in the face but tell me what I am doing wrong please.
error: TypeError: 'set' on proxy: trap returned falsish for property 'port'
Example
'use strict'; // this makes the error throw
function ObserveObject(object, callback) {
function createProxy(prefix, object) {
return new Proxy(object, {
set: function(target, property, value) {
target[property] = value;
callback(prefix + property, value);
},
get: function(target, property) {
var value = target[property];
if (isObject(value)) return createProxy(prefix + property + '.', value);
else return value;
}
});
}
return createProxy('', object);
}
function isObject(value) {
if (value === null || value === undefined) return false;
else return value.constructor === Object;
}
var o = {
hello: 'blue',
app: {
env: {
port: 7777,
la: 1
}
},
more: 'stuff'
};
var m = ObserveObject (o, function(path, value) {
console.log(path);
console.log(value);
});
m.app.env.port = 8888;
console.log(m);
Issue Analytics
- State:
- Created 7 years ago
- Reactions:14
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: 'set' on proxy: trap returned falsish for ...
I got the error (not exactly the same) but was able to replicate. Seems like you cannot set a value directly to the...
Read more >Vue3: Uncaught TypeError: 'set' on proxy: trap returned falsish ...
I got an error message: Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'NewTodo'. That error appear when im trying ...
Read more >Getting Started with Modern JavaScript — Proxy - Michael Karén
Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'age'. In addition to intercepting reads and modifications to properties, Proxy can ...
Read more >TypeError: 'deleteProperty' on proxy: trap returned falsish for ...
I am aware that I may not have fully understood the way transactions are set up, but I found relatively little documentation or...
Read more >Uncaught TypeError: 'set' on proxy: trap returned falsish for ...
Uncaught TypeError: 'set' on proxy: trap returned falsish for property Name – salesforce lightning web component.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oops…
I think I figured it out.
Link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/set
"Return value
The set method should return a boolean value. Return true to indicate that assignment succeeded. If the set method returns false, and the assignment happened in strict-mode code, a TypeError will be thrown."
Should return true in the set method.
This is pretty weird though can anyone explain why?