Currently, if you any properties cloned with rfdc are an `ArrayBuffer` in a browser, this exception will appear unless you have polyfilled Buffer: ```ts Uncaught (in promise) ReferenceError: Buffer is not defined at copyBuffer (index.js:5) at clone (index.js:50) at PropertyPanel.tsx:196 at mountState (react-dom.development.js:15626) at Object.useState (react-dom.development.js:16248) at Object.useState4 (react.development.js:1508) at PropertyPane (PropertyPanel.tsx:196) at renderWithHooks (react-dom.development.js:14985) at mountIndeterminateComponent (react-dom.development.js:17811) at beginWork (react-dom.development.js:19049) ``` It looks like the responsible code is here: ```ts function copyBuffer (cur) { if (cur instanceof Buffer) { return Buffer.from(cur) } return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length) } ``` There are two issues with this function: 1. This clones the entire `ArrayBuffer`, when it only needs to clone the section relevant to the view. In other words, `return cur.slice()` would work, as `TypedArray.prototype.slice` will copy the section of the underlying `ArrayBuffer`. 2. Since `Buffer` extends `Uint8Array`[0], you don't need to check if `cur` is a `Buffer`. `.slice` on a `Buffer` will return a `Buffer` [0]: "The `Buffer` class is a subclass of JavaScript's `Uint8Array` class and extends it with methods that cover additional use cases." - https://nodejs.org/api/buffer.html#buffer_buffer
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by Jarred-Sumner and has received 3 comments.