Last active
March 30, 2025 00:13
-
-
Save wplit/c47502017f8fff4226045b57f22682c8 to your computer and use it in GitHub Desktop.
wpgb bricks addon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* current code, fails when fails when t.body is undefined */ | |
request: function (e, t) { | |
const { body: n } = t; // This fails when t.body is undefined | |
r = JSON.parse(n); | |
return "bricks_render_element" === r?.action && r?.element && (m(r.element), E(r.element.id)), [e, t]; | |
} | |
// Possible solution, returns original request if no body | |
request: function (e, t) { | |
if (t && t.body) { | |
const { body: n } = t; | |
r = JSON.parse(n); | |
return "bricks_render_element" === r?.action && r?.element && (m(r.element), E(r.element.id)), [e, t]; | |
} | |
return [e, t]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment