Skip to content

Commit

Permalink
fix: added boolean return for global set to fix Proxy set trapped err…
Browse files Browse the repository at this point in the history
…or (#134)

* fix: added boolean return for global set to fix Proxy set trapped error

* fox: added receiver paramer for setter

* remvoed Reflect as it caused issues with window proxy object

* Release 2.8.2
  • Loading branch information
Shubhakar-A authored Aug 17, 2023
1 parent 9753bdd commit 1970c92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/global/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ var getGlobal = function () {
global import in all bundle use cases
*/
if (globalObj && globalObj.__esModule) {
const override = {
get: function (target, prop, receiver) {
const proxyGlobal = new Proxy(globalObj, {
get: function (target, prop) {
if (prop === 'default') {
return target
}

return Reflect.get(receiver, prop, target)
return target[prop]
},

set: function (target, prop, value) {
Reflect.set(target, prop, value)
target[prop] = value
return true
},
};
const proxyGlobal = new Proxy(globalObj, override)
})
return proxyGlobal
}
return globalObj
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bv-ui-core",
"version": "2.8.1",
"version": "2.8.2",
"license": "Apache 2.0",
"description": "Bazaarvoice UI-related JavaScript",
"repository": {
Expand Down

0 comments on commit 1970c92

Please sign in to comment.