When build in release-optimised mode, the FDB Cursor no longer works, due to erroneous runtime type-checking.
The outcome is that a null or undefined value is returned from any Cursor Read operation. No exception is thrown, so it's difficult to debug. Everything works just fine in a normal development environment. To replicate the issue something like the Webpack Terser plugin must be used to optimise the javascript output.
Summary: code similar to the following occurs 3 times in FDBCursor.cs. In an optimised build, the name of the constructor will be different, causing these conditions to never be fulfilled.
if ( !this._keyOnly && this.constructor.name === "FDBCursorWithValue" ) {
Resolution: Since both FDBCursor and the derived class FDBCursorWithValue already implement a toString() function, a quick fix is as follows:
if ( !this._keyOnly && this.toString() === "[object IDBCursorWithValue]" ) {
Thanks! Probably not a lot of people are minifying it, but your suggested fix sounds reasonable and all the tests still pass, so I just put it in v3.1.3.
When build in release-optimised mode, the FDB Cursor no longer works, due to erroneous runtime type-checking.
The outcome is that a null or undefined value is returned from any Cursor Read operation. No exception is thrown, so it's difficult to debug. Everything works just fine in a normal development environment. To replicate the issue something like the Webpack Terser plugin must be used to optimise the javascript output.
Summary: code similar to the following occurs 3 times in FDBCursor.cs. In an optimised build, the name of the constructor will be different, causing these conditions to never be fulfilled.
if ( !this._keyOnly && this.constructor.name === "FDBCursorWithValue" ) {
Resolution: Since both FDBCursor and the derived class FDBCursorWithValue already implement a toString() function, a quick fix is as follows:if ( !this._keyOnly && this.toString() === "[object IDBCursorWithValue]" ) {